| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #!/bin/bash
- # info: update system queue
- # options: pipe
- #
- # This function is responsible queue processing. Restarts of services,
- # scheduled backups, web log parsing and other heavy resource consuming
- # operations are handled by this script. It helps to optimize system behaviour.
- # In a nutshell Apache will be restarted only once even if 10 domains are
- # added or deleted.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument defenition
- queue=$1
- # Importing system enviroment as we run this script
- # mostly by cron wich not read it by itself
- source /etc/profile.d/vesta.sh
- # Importing variables
- source $VESTA/conf/vesta.conf
- source $VESTA/func/shared.sh
- # Export PATH for cron
- PATH=$PATH:$BIN
- # Defining pipe functions
- restart_pipe() {
- bash $VESTA/data/queue/restart.pipe
- rm $VESTA/data/queue/restart.pipe
- touch $VESTA/data/queue/restart.pipe
- }
- stats_pipe() {
- bash $VESTA/data/queue/stats.pipe
- }
- disk_pipe() {
- bash $VESTA/data/queue/disk.pipe
- }
- traff_pipe() {
- bash $VESTA/data/queue/traffic.pipe
- }
- backup_pipe() {
- bash $VESTA/data/queue/backup.pip
- }
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- # Checking arg number
- check_args '1' "$#" 'queue'
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- case $queue in
- restart) restart_pipe ;;
- stats) stats_pipe ;;
- backup) backup_pipe ;;
- disk) disk_pipe ;;
- traffic) traff_pipe ;;
- *) check_args '1' '0' 'queue'
- esac
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Logging
- log_event "$OK" "$EVENT"
- exit
|