2e500e1196b284796dd349712aba697d1e138579
[zfs-ubuntu/.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 # Setup some default values
8 autosnap="/usr/local/etc/bin/zfs-autosnap"
9 logfile="/var/log/zfs-autosnap.log"
10 numsnapshots=20
11 maxagedays=365
12
13 # Auto snapshot every zfs filesystem on the system specified below
14 date >> $logfile
15
16 # Special filesystems
17 $autosnap storage /storage $numsnapshots 15
18 $autosnap tank/usr/videos /usr/videos $numsnapshots 15
19
20 # Normal filesystems
21 $autosnap tank / $numsnapshots $maxagedays 
22 $autosnap tank/backup /backup $numsnapshots $maxagedays
23 $autosnap tank/usr /usr $numsnapshots $maxagedays
24 $autosnap tank/usr/home /usr/home $numsnapshots $maxagedays
25 $autosnap tank/usr/local /usr/local $numsnapshots $maxagedays
26 $autosnap tank/usr/local/etc /usr/local/etc $numsnapshots $maxagedays
27
28 # Daily filesystems (only perform these at midnight)
29 if [ `date +"%H:%M"` == "00:00" ]; then 
30   $autosnap tank/var /var $numsnapshots $maxagedays
31   $autosnap tank/usr/local/var /usr/local/var $numsnapshots $maxagedays
32 fi
33