v_update_sys_queue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # info: update system queue
  3. # options: pipe
  4. #
  5. # This function is responsible queue processing. Restarts of services,
  6. # scheduled backups, web log parsing and other heavy resource consuming
  7. # operations are handled by this script. It helps to optimize system behaviour.
  8. # In a nutshell Apache will be restarted only once even if 10 domains are
  9. # added or deleted.
  10. #----------------------------------------------------------#
  11. # Variable&Function #
  12. #----------------------------------------------------------#
  13. # Argument defenition
  14. queue=$1
  15. # Importing system enviroment as we run this script
  16. # mostly by cron wich not read it by itself
  17. source /etc/profile.d/vesta.sh
  18. # Includes
  19. source $VESTA/conf/vesta.conf
  20. source $VESTA/func/main.sh
  21. # Export PATH for cron
  22. PATH=$PATH:$BIN
  23. export $PATH
  24. #----------------------------------------------------------#
  25. # Verifications #
  26. #----------------------------------------------------------#
  27. check_args '1' "$#" 'queue'
  28. #----------------------------------------------------------#
  29. # Action #
  30. #----------------------------------------------------------#
  31. # Defining pipe functions
  32. case $queue in
  33. restart) bash $VESTA/data/queue/restart.pipe;
  34. rm $VESTA/data/queue/restart.pipe;
  35. touch $VESTA/data/queue/restart.pipe;;
  36. stats) bash $VESTA/data/queue/stats.pipe;;
  37. backup) bash $VESTA/data/queue/backup.pip;;
  38. disk) bash $VESTA/data/queue/disk.pipe;;
  39. traffic) bash $VESTA/data/queue/traffic.pipe;;
  40. *) check_args '1' '0' 'queue'
  41. esac
  42. #----------------------------------------------------------#
  43. # Vesta #
  44. #----------------------------------------------------------#
  45. # Logging
  46. log_event "$OK" "$EVENT"
  47. exit