| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #!/bin/bash
- # info: updating system queue
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument defenition
- pipe=$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/vars.conf
- source $V_CONF/vesta.conf
- source $V_FUNC/shared.func
- # Defining pipe functions
- restart_pipe() {
- for service in $(cat $V_QUEUE/restart.pipe |sort |uniq); do
- $V_BIN/v_restart_$service
- done
- echo > $V_QUEUE/restart.pipe
- }
- stats_pipe() {
- bash $V_QUEUE/stats.pipe
- }
- disk_pipe() {
- bash $V_QUEUE/disk.pipe
- }
- traff_pipe() {
- bash $V_QUEUE/traffic.pipe
- }
- backup_pipe() {
- for user in $(cat $V_QUEUE/backup.pipe |sort |uniq ); do
- sed -i "/^$user$/d" $V_QUEUE/backup.pipe
- bash $V_BIN/v_backup_user $user
- # Send notification to user
- done
- }
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- # Checking arg number
- check_args '1' "$#" 'pipe'
- # Checking argument format
- format_validation 'pipe'
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- case $pipe in
- restart) restart_pipe ;;
- stats) stats_pipe ;;
- backup) backup_pipe ;;
- disk) disk_pipe ;;
- traffic) traff_pipe ;;
- *) check_args '1' '0' 'pipe'
- esac
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Logging
- log_event 'system' "$V_EVENT"
- exit
|