Changed default throttle options
[zfs-nexenta/.git] / zfs-autosnap-wrapper
1 #!/bin/bash
2
3 # Author: Alan J. Pippin
4 # Description: This script is a wrapper script that calls zfs-autosnap
5 #              for each filesystem provided below.
6
7 # source our configuration
8 config="${0%/*}/zfs-scripts.conf"
9 [ -e "${config}.dist" ] && . ${config}.dist
10 [ -e "${config}" ] && . ${config}
11
12 # Setup some default values
13 logfile="$logdir/zfs-autosnap.log"
14 numsnapshots=20
15 maxagedays=365
16 date=`date`
17 mylockdir="/tmp/zfs-autosnap-all"
18
19 # Make sure we aren't already running
20 if ! mkdir "$mylockdir" >/dev/null 2>&1; then
21   echo "$date Another $0 process is already running" >> $logfile
22   exit 1
23 fi
24
25 # Auto snapshot every zfs filesystem on the system specified below
26 date >> $logfile
27
28 # Special filesystems
29 zfs-autosnap storage /storage $numsnapshots 15
30 zfs-autosnap tank/usr/videos /usr/videos $numsnapshots 15
31
32 # Normal filesystems
33 zfs-autosnap tank / $numsnapshots $maxagedays 
34 zfs-autosnap tank/home /home $numsnapshots $maxagedays
35
36 # Daily filesystems (only perform these at midnight)
37 if [ `date +"%H:%M"` == "00:00" ]; then 
38    echo "Performing Daily snapshots" >> $logfile
39 fi
40
41 # Weekly filesystems (only perform these on Sunday at midnight)
42 if [ `date +"%H:%M:%u"` == "00:00:7" ]; then
43   echo "Performing Weekly snapshots" >> $logfile
44 fi
45
46 rm -rf "$mylockdir"