v_upd_sys_queue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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
  14. # Defining pipe functions
  15. restart_pipe() {
  16. for service in $(cat $V_QUEUE/restart.pipe |sort |uniq); do
  17. $V_BIN/v_restart_$service
  18. done
  19. echo > $V_QUEUE/restart.pipe
  20. }
  21. stats_pipe() {
  22. bash $V_QUEUE/stats.pipe
  23. }
  24. disk_pipe() {
  25. bash $V_QUEUE/disk.pipe
  26. }
  27. traff_pipe() {
  28. bash $V_QUEUE/traffic.pipe
  29. }
  30. #----------------------------------------------------------#
  31. # Verifications #
  32. #----------------------------------------------------------#
  33. # Checking arg number
  34. check_args '1' "$#" 'pipe'
  35. # Checking argument format
  36. format_validation 'pipe'
  37. #----------------------------------------------------------#
  38. # Action #
  39. #----------------------------------------------------------#
  40. case $pipe in
  41. restart) restart_pipe ;;
  42. stats) stats_pipe ;;
  43. backup) backup_pipe ;;
  44. disk) disk_pipe ;;
  45. traffic) traff_pipe ;;
  46. *) check_args '1' '0' 'pipe'
  47. esac
  48. #----------------------------------------------------------#
  49. # Vesta #
  50. #----------------------------------------------------------#
  51. # Logging
  52. log_event 'system' "$V_EVENT"
  53. exit