...
 
Commits (13)
......@@ -14,6 +14,6 @@ install:
install etc/zfs-auto-snapshot.cron.weekly $(DESTDIR)/etc/cron.weekly/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.monthly $(DESTDIR)/etc/cron.monthly/zfs-auto-snapshot
install -d $(DESTDIR)$(PREFIX)/share/man/man8
install src/zfs-auto-snapshot.8 $(DESTDIR)$(PREFIX)/share/man/man8/zfs-auto-snapshot.8
install -m 0644 src/zfs-auto-snapshot.8 $(DESTDIR)$(PREFIX)/share/man/man8/zfs-auto-snapshot.8
install -d $(DESTDIR)$(PREFIX)/sbin
install src/zfs-auto-snapshot.sh $(DESTDIR)$(PREFIX)/sbin/zfs-auto-snapshot
......@@ -11,11 +11,13 @@ snapshots if it is installed.
This program is a posixly correct bourne shell script. It depends only on
the zfs utilities and cron, and can run in the dash shell.
Orginal Repo:
https://github.com/zfsonlinux/zfs-auto-snapshot
Installation:
-------------
wget https://github.com/zfsonlinux/zfs-auto-snapshot/archive/master.zip
unzip master.zip
cd zfs-auto-snapshot-master
git clone https://git.elaon.de/alex/zfs-auto-snapshot.git
cd zfs-auto-snapshot
make install
#!/bin/sh
# Only call zfs-auto-snapshot if it's available
which zfs-auto-snapshot > /dev/null && \
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=daily --keep=31 //
which zfs-auto-snapshot > /dev/null || exit 0
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=daily --keep=31 //
PATH="/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
*/15 * * * * root which zfs-auto-snapshot > /dev/null && zfs-auto-snapshot --prefix=zas --quiet --syslog --label=frequent --keep=4 //
*/15 * * * * root which zfs-auto-snapshot > /dev/null || exit 0 ; zfs-auto-snapshot --prefix=zas --quiet --syslog --label=frequent --keep=4 //
#!/bin/sh
# Only call zfs-auto-snapshot if it's available
which zfs-auto-snapshot > /dev/null && \
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=hourly --keep=24 //
which zfs-auto-snapshot > /dev/null || exit 0
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=hourly --keep=24 //
#!/bin/sh
# Only call zfs-auto-snapshot if it's available
which zfs-auto-snapshot > /dev/null && \
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=monthly --keep=12 //
which zfs-auto-snapshot > /dev/null || exit 0
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=monthly --keep=12 //
#!/bin/sh
# Only call zfs-auto-snapshot if it's available
which zfs-auto-snapshot > /dev/null && \
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=weekly --keep=8 //
which zfs-auto-snapshot > /dev/null || exit 0
exec zfs-auto-snapshot --prefix=zas --quiet --syslog --label=weekly --keep=8 //
......@@ -110,7 +110,7 @@ print_log () # level, message, ...
;;
(inf*)
# test -n "$opt_syslog" && logger -t "$opt_prefix" -p daemon.info $*
test -n "$opt_verbose" && echo $*
test -z ${opt_quiet+x} && test -n "$opt_verbose" && echo $*
;;
(deb*)
# test -n "$opt_syslog" && logger -t "$opt_prefix" -p daemon.debug $*
......@@ -367,20 +367,21 @@ fi
ZPOOL_STATUS=$(env LC_ALL=C zpool status 2>&1 ) \
|| { print_log error "zpool status $?: $ZPOOL_STATUS"; exit 135; }
ZFS_LIST=$(env LC_ALL=C zfs list -H -t filesystem,volume -s name \
-o name,com.sun:auto-snapshot,com.sun:auto-snapshot:"$opt_label") \
|| { print_log error "zfs list $?: $ZFS_LIST"; exit 136; }
if [ -n "$opt_fast_zfs_list" ]
then
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -o name -s name | \
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -o name -s name | \
grep $opt_prefix | \
awk '{ print substr( $0, length($0) - 14, length($0) ) " " $0}' | \
sort -r -k1,1 -k2,2 | \
awk '{ print substr( $0, 17, length($0) )}') \
|| { print_log error "zfs list $?: $SNAPSHOTS_OLD"; exit 137; }
else
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -S creation -o name) \
SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -S creation -o name) \
|| { print_log error "zfs list $?: $SNAPSHOTS_OLD"; exit 137; }
fi
......@@ -440,7 +441,8 @@ do
# Just testing "$ii" != ${ii#$jj} would incorrectly match.
iii="$ii/"
# Exclude datasets that are not named on the command line.
# Exclude datasets that are not named on the command line.
IN_ARGS='0'
for jj in "$@"
do
......