v_upd_sys_queue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. # info: updating system queue
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. pipe="$1"
  8. # Importing system enviroment as we run this script
  9. # mostly by cron wich not read it by itself
  10. source /etc/profile.d/vesta.sh
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_FUNC/shared_func.sh
  14. # Another workaround for cron enviroment
  15. PATH="$PATH:$V_BIN"
  16. export PATH
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. # Checking arg number
  21. check_args '1' "$#" 'pipe'
  22. # Checking argument format
  23. format_validation 'pipe'
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Defining pipe functions
  28. restart_pipe() {
  29. for service in $(cat $V_QUEUE/restart.pipe |sort |uniq); do
  30. $V_FUNC/restart_$service
  31. done
  32. echo >$V_QUEUE/restart.pipe
  33. }
  34. stats_pipe() {
  35. bash $V_QUEUE/stats.pipe
  36. }
  37. backup_pipe() {
  38. bash $V_QUEUE/backup.pipe
  39. }
  40. disk_pipe() {
  41. bash $V_QUEUE/disk.pipe
  42. }
  43. traff_pipe() {
  44. bash $V_QUEUE/traffic.pipe
  45. }
  46. case $pipe in
  47. restart) restart_pipe ;;
  48. stats) stats_pipe ;;
  49. backup) backup_pipe ;;
  50. disk) disk_pipe ;;
  51. traffic) traff_pipe ;;
  52. *) check_args '1' '0' 'pipe'
  53. esac
  54. #----------------------------------------------------------#
  55. # Vesta #
  56. #----------------------------------------------------------#
  57. # Logging
  58. log_event 'system' "$V_EVENT"
  59. exit $OK