Skip to content

Commit 9513f98

Browse files
committed
sceduled backup support
1 parent 7ba0758 commit 9513f98

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

bin/v_add_sys_user_backup

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
# info: schedule user backup
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Argument defenition
9+
user=$1
10+
11+
# Importing variables
12+
source $VESTA/conf/vars.conf
13+
source $V_CONF/vesta.conf
14+
source $V_FUNC/shared.func
15+
16+
17+
#----------------------------------------------------------#
18+
# Verifications #
19+
#----------------------------------------------------------#
20+
21+
# Checking arg number
22+
check_args '1' "$#" 'user'
23+
24+
# Checking argument format
25+
format_validation 'user'
26+
27+
# Checking backup system is enabled
28+
is_system_enabled 'backup'
29+
30+
# Checking user
31+
is_user_valid
32+
33+
# Checking user backups
34+
is_backup_enabled
35+
36+
37+
#----------------------------------------------------------#
38+
# Action #
39+
#----------------------------------------------------------#
40+
41+
# Adding backup to pipe
42+
echo "$user" >> $V_QUEUE/backup.pipe
43+
44+
45+
#----------------------------------------------------------#
46+
# Vesta #
47+
#----------------------------------------------------------#
48+
49+
# Logging
50+
log_event 'system' "$V_EVENT"
51+
52+
exit

bin/v_upd_sys_queue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ traff_pipe() {
3636
bash $V_QUEUE/traffic.pipe
3737
}
3838

39+
backup_pipe() {
40+
for user in $(cat $V_QUEUE/backup.pipe |sort |uniq ); do
41+
sed -i "/^$user$/d" $V_QUEUE/backup.pipe
42+
bash $V_BIN/v_backup_sys_user $user
43+
# Send notification to user
44+
done
45+
}
46+
3947

4048

4149
#----------------------------------------------------------#

0 commit comments

Comments
 (0)