-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup.vars.sample
56 lines (47 loc) · 1.02 KB
/
backup.vars.sample
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
#
# variable file for ZFS backup scripts
#
# username or email address receiving notifications (no default)
#MAIL_USER=""
# directory path where to store log files
LOGDIR=.
# full file path for all the shell outputs
EXECLOGFILE=${LOGDIR}/exec.log
# retention time for all log files
LOG_RETENTION=60
# number of snapshot to retain before their cleaned up
SNAPS_RETENTION=2
# zpool and zfs path identification
if [ ! -z `which zfs` ]
then
ZFS=`which zfs`
fi
if [ ! -z `which zpool` ]
then
ZPOOL=`which zpool`
fi
TODAY=`date +"%Y%m%d"`
#YESTERDAY=`date -d 'yesterday' +"%Y%m%d"`
# common functions for the scripts
log()
{
echo "`date +%Y%m%d-%H%M` - `basename $0` - $1" >> $EXECLOGFILE
}
fatal()
{
log "$1"
echo "Fatal error. Exiting"
exit 1
}
sndmail()
{
if [ ! -z ${MAIL_USER} ]
then
tail -15 $EXECLOGFILE | mail -s "SERVER WARNING : problem during backup" $MAIL_USER
fi
}
# basic check for ZFS CLI presence
if [ -z ${ZFS} -o -z ${ZPOOL} ]
then
fatal "The zfs or zpool program cannot be found. Exiting"
fi