fn_messages 999 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # LGSM fn_messages function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 241214
  6. #
  7. # Description: Defines on-screen messages such as and now script logs look
  8. # Displays date and servicename for log files
  9. fn_scriptlog(){
  10. echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}"
  11. }
  12. # [ FAIL ]
  13. fn_printfail(){
  14. echo -en "\r\033[K[\e[0;31m FAIL \e[0;39m] $@"
  15. }
  16. fn_printfailnl(){
  17. echo -e "\r\033[K[\e[0;31m FAIL \e[0;39m] $@"
  18. }
  19. # [ OK ]
  20. fn_printok(){
  21. echo -en "\r\033[K[\e[0;32m OK \e[0;39m] $@"
  22. }
  23. fn_printoknl(){
  24. echo -e "\r\033[K[\e[0;32m OK \e[0;39m] $@"
  25. }
  26. # [ INFO ]
  27. fn_printinfo(){
  28. echo -en "\r\033[K[\e[0;36m INFO \e[0;39m] $@"
  29. }
  30. fn_printinfonl(){
  31. echo -e "\r\033[K[\e[0;36m INFO \e[0;39m] $@"
  32. }
  33. # [ WARN ]
  34. fn_printwarn(){
  35. echo -en "\r\033[K[\e[1;33m WARN \e[0;39m] $@"
  36. }
  37. fn_printwarnnl(){
  38. echo -e "\r\033[K[\e[1;33m WARN \e[0;39m] $@"
  39. }
  40. # [ .... ]
  41. fn_printdots(){
  42. echo -en "\r\033[K[ .... ] $@"
  43. }