projects
/
zfs-ubuntu
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b2455b4
)
Fixed midnight bug in autosnap wrapper script
author
Alan J. Pippin
<ajp@pippins.net>
Sun, 18 Jan 2009 20:33:02 +0000
(13:33 -0700)
committer
Alan J. Pippin
<ajp@pippins.net>
Sun, 18 Jan 2009 20:33:02 +0000
(13:33 -0700)
zfs-autosnap-wrapper
patch
|
blob
|
history
diff --git
a/zfs-autosnap-wrapper
b/zfs-autosnap-wrapper
index ab09272e22c471d1609ec251337dbdf1002fd1f5..fc17c0872bc3e0c2c83efde7da266c235ee3e437 100755
(executable)
--- a/
zfs-autosnap-wrapper
+++ b/
zfs-autosnap-wrapper
@@
-15,6
+15,9
@@
numsnapshots=20
maxagedays=365
date=`date`
mylockdir="/tmp/zfs-autosnap-all"
maxagedays=365
date=`date`
mylockdir="/tmp/zfs-autosnap-all"
+current_hour=`date +"%H"`
+current_minute=`date +"%M"`
+current_day=`date +"%u"`
# Make sure we aren't already running
if ! mkdir "$mylockdir" >/dev/null 2>&1; then
# Make sure we aren't already running
if ! mkdir "$mylockdir" >/dev/null 2>&1; then
@@
-26,20
+29,22
@@
fi
date >> $logfile
# Special filesystems
date >> $logfile
# Special filesystems
-zfs-autosnap storage /storage $numsnapshots 15
-zfs-autosnap tank/usr/videos /usr/videos $numsnapshots 15
+
# ex:
zfs-autosnap storage /storage $numsnapshots 15
+
# ex:
zfs-autosnap tank/usr/videos /usr/videos $numsnapshots 15
# Normal filesystems
# Normal filesystems
-zfs-autosnap tank / $numsnapshots $maxagedays
-zfs-autosnap tank/home /home $numsnapshots $maxagedays
+
# ex:
zfs-autosnap tank / $numsnapshots $maxagedays
+
# ex:
zfs-autosnap tank/home /home $numsnapshots $maxagedays
# Daily filesystems (only perform these at midnight)
# Daily filesystems (only perform these at midnight)
-if [ `date +"%H:%M"` == "00:00" ]; then
+# midnight = true if (midnight < current time < midnight+5 min)
+if [[ $current_hour == "00" && $current_minute -lt 5 ]]; then
echo "Performing Daily snapshots" >> $logfile
fi
# Weekly filesystems (only perform these on Sunday at midnight)
echo "Performing Daily snapshots" >> $logfile
fi
# Weekly filesystems (only perform these on Sunday at midnight)
-if [ `date +"%H:%M:%u"` == "00:00:7" ]; then
+# midnight = true if (midnight < current time < midnight+5 min)
+if [[ $current_day == "7" && $current_hour == "00" && $current_minute -lt 5 ]]; then
echo "Performing Weekly snapshots" >> $logfile
fi
echo "Performing Weekly snapshots" >> $logfile
fi