v_upd_sys_queue 1.7 KB

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