Files
VestaCP/bin/v_update_sys_queue

62 lines
1.9 KiB
Plaintext
Raw Normal View History

2011-06-14 00:22:25 +03:00
#!/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.
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
2012-03-06 22:07:06 +02:00
queue=$1
2011-06-14 00:22:25 +03:00
# Importing system enviroment as we run this script
# mostly by cron wich not read it by itself
2011-06-14 00:22:25 +03:00
source /etc/profile.d/vesta.sh
2012-03-31 22:55:50 +03:00
# Includes
2012-03-06 22:07:06 +02:00
source $VESTA/conf/vesta.conf
2012-04-30 12:32:11 +03:00
source $VESTA/func/main.sh
2011-06-14 00:22:25 +03:00
# Export PATH for cron
2012-03-06 22:07:06 +02:00
PATH=$PATH:$BIN
2012-03-31 22:55:50 +03:00
export $PATH
2011-11-01 13:02:44 +02:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
2012-03-06 22:07:06 +02:00
check_args '1' "$#" 'queue'
2011-11-01 13:02:44 +02:00
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
2012-03-31 22:55:50 +03:00
# Defining pipe functions
2012-03-06 22:07:06 +02:00
case $queue in
2012-03-31 22:55:50 +03:00
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;;
2012-03-06 22:07:06 +02:00
*) check_args '1' '0' 'queue'
2011-06-14 00:22:25 +03:00
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
2012-03-06 22:07:06 +02:00
log_event "$OK" "$EVENT"
2011-06-14 00:22:25 +03:00
2011-11-01 12:27:45 +02:00
exit