Files
VestaCP/bin/v_update_sys_queue
2012-03-31 22:55:50 +03:00

62 lines
1.9 KiB
Bash
Executable File

#!/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
# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/shared.sh
# Export PATH for cron
PATH=$PATH:$BIN
export $PATH
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'queue'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining pipe functions
case $queue in
restart) bash $VESTA/data/queue/restart.pipe;
rm $VESTA/data/queue/restart.pipe;
touch $VESTA/data/queue/restart.pipe;;
stats) bash $VESTA/data/queue/stats.pipe;;
backup) bash $VESTA/data/queue/backup.pip;;
disk) bash $VESTA/data/queue/disk.pipe;;
traffic) bash $VESTA/data/queue/traffic.pipe;;
*) check_args '1' '0' 'queue'
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$EVENT"
exit