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
  18. # Includes
  19. source $VESTA/conf/vesta.conf
  20. source $VESTA/func/main.sh
  21. # Export PATH for cron
  22. PATH=$PATH:$BIN
  23. #----------------------------------------------------------#
  24. # Verifications #
  25. #----------------------------------------------------------#
  26. check_args '1' "$#" 'queue'
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Defining pipe functions
  31. case $queue in
  32. restart) bash $VESTA/data/queue/restart.pipe;
  33. rm $VESTA/data/queue/restart.pipe;
  34. touch $VESTA/data/queue/restart.pipe;;
  35. webstats) bash $VESTA/data/queue/webstats.pipe > /dev/null 2>&1 ;;
  36. backup) bash $VESTA/data/queue/backup.pipe;;
  37. disk) bash $VESTA/data/queue/disk.pipe;;
  38. traffic) bash $VESTA/data/queue/traffic.pipe;;
  39. *) check_args '1' '0' 'queue'
  40. esac
  41. #----------------------------------------------------------#
  42. # Vesta #
  43. #----------------------------------------------------------#
  44. # No Logging
  45. #log_event "$OK" "$EVENT"
  46. exit