Skip to content

Commit 9c6f065

Browse files
committed
Check whether we have zfs-auto-snapshot before running it
1 parent 62f5f7d commit 9c6f065

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

etc/zfs-auto-snapshot.cron.daily

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/bin/sh
2-
exec zfs-auto-snapshot --quiet --syslog --label=daily --keep=31 //
2+
3+
# Only call zfs-auto-snapshot if it's available
4+
exec which zfs-auto-snapshot > /dev/null && \
5+
zfs-auto-snapshot --quiet --syslog --label=daily --keep=31 //
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
PATH="/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
22

3-
*/15 * * * * root zfs-auto-snapshot --quiet --syslog --label=frequent --keep=4 //
3+
*/15 * * * * root which zfs-auto-snapshot > /dev/null && zfs-auto-snapshot --quiet --syslog --label=frequent --keep=4 //

etc/zfs-auto-snapshot.cron.hourly

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/bin/sh
2-
exec zfs-auto-snapshot --quiet --syslog --label=hourly --keep=24 //
2+
3+
# Only call zfs-auto-snapshot if it's available
4+
exec which zfs-auto-snapshot > /dev/null && \
5+
zfs-auto-snapshot --quiet --syslog --label=hourly --keep=24 //

etc/zfs-auto-snapshot.cron.monthly

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/bin/sh
2-
exec zfs-auto-snapshot --quiet --syslog --label=monthly --keep=12 //
2+
3+
# Only call zfs-auto-snapshot if it's available
4+
exec which zfs-auto-snapshot > /dev/null && \
5+
zfs-auto-snapshot --quiet --syslog --label=monthly --keep=12 //

etc/zfs-auto-snapshot.cron.weekly

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/bin/sh
2-
exec zfs-auto-snapshot --quiet --syslog --label=weekly --keep=8 //
2+
3+
# Only call zfs-auto-snapshot if it's available
4+
exec which zfs-auto-snapshot > /dev/null && \
5+
zfs-auto-snapshot --quiet --syslog --label=weekly --keep=8 //

0 commit comments

Comments
 (0)