v_upd_sys_queue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. disk_pipe() {
  38. bash $V_QUEUE/disk.pipe
  39. }
  40. traff_pipe() {
  41. bash $V_QUEUE/traffic.pipe
  42. }
  43. case $pipe in
  44. restart) restart_pipe ;;
  45. stats) stats_pipe ;;
  46. backup) backup_pipe ;;
  47. disk) disk_pipe ;;
  48. traffic) traff_pipe ;;
  49. *) check_args '1' '0' 'pipe'
  50. esac
  51. #----------------------------------------------------------#
  52. # Vesta #
  53. #----------------------------------------------------------#
  54. # Logging
  55. log_event 'system' "$V_EVENT"
  56. exit