From 9513f98b0494a29e44f3c58f1f1bc748e0a2533e Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Wed, 23 Nov 2011 16:50:56 +0200 Subject: [PATCH] sceduled backup support --- bin/v_add_sys_user_backup | 52 +++++++++++++++++++++++++++++++++++++++ bin/v_upd_sys_queue | 8 ++++++ 2 files changed, 60 insertions(+) create mode 100755 bin/v_add_sys_user_backup diff --git a/bin/v_add_sys_user_backup b/bin/v_add_sys_user_backup new file mode 100755 index 00000000..177dd4e9 --- /dev/null +++ b/bin/v_add_sys_user_backup @@ -0,0 +1,52 @@ +#!/bin/bash +# info: schedule user backup + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user=$1 + +# Importing variables +source $VESTA/conf/vars.conf +source $V_CONF/vesta.conf +source $V_FUNC/shared.func + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking backup system is enabled +is_system_enabled 'backup' + +# Checking user +is_user_valid + +# Checking user backups +is_backup_enabled + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Adding backup to pipe +echo "$user" >> $V_QUEUE/backup.pipe + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit diff --git a/bin/v_upd_sys_queue b/bin/v_upd_sys_queue index 1573a323..fb5ce54a 100755 --- a/bin/v_upd_sys_queue +++ b/bin/v_upd_sys_queue @@ -36,6 +36,14 @@ 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_sys_user $user + # Send notification to user + done +} + #----------------------------------------------------------#