-
Notifications
You must be signed in to change notification settings - Fork 1
/
200.mysqlbackup.weekly
59 lines (50 loc) · 1.32 KB
/
200.mysqlbackup.weekly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# MySQL server maintenance with mysqlbackup(1) tool.
#
# Configurable tunes:
#
# mysqlbackup_enable (bool): enables or disables mysqlbackup(1) tool. The
# default is "no".
#
# mysqlbackup_schedule (str): run mysqlbackup(1) either `daily' or `weekly'
# or `monthly'. By default mysqlbackup(1) runs
# by a daily schedule.
#
# mysqlbackup_args (str): pass to mysqlbackup(1) program additional
# arguments. By default they are set to "-a
# -l30", which means to backup all the available
# databases and keep backups for a minimum one
# month. For any other arguments please check
# the manual page for mysqlbackup.
#
# $Id$
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
source_periodic_confs
fi
: ${mysqlbackup_enable="no"}
: ${mysqlbackup_schedule="daily"}
: ${mysqlbackup_args="-a -l30"}
mysqlbackup=%%PREFIX%%/bin/mysqlbackup
do_backup()
{
echo; echo "Creating MySQL server backups"
rc=1
${mysqlbackup} ${mysqlbackup_args} || rc=2
echo "MySQL server backup done";
return 0
}
rc=0
case "${mysqlbackup_enable}" in
[Yy][Ee][Ss])
case "${mysqlbackup_schedule}" in
[dD][aA][iI][lL][yY]);;
[wW][eE][eE][kK][lL][yY]) do_backup ;;
[mM][oO][nN][tT][hH][lL][yY]);;
esac;;
esac
exit ${rc}