36 Commits

Author SHA1 Message Date
Darik Horn
45edfd3e7c Merge pull request #9 from mk01/zevo
Zevo
2013-01-14 11:05:37 -08:00
Matus Kral
85dd8dad9a missing quotations, under bash ok, under dash critical 2013-01-14 11:13:47 +01:00
Matus Kral
feea013d3c cosmetic bug which showed filesystem added for regular snapshot as recursive 2013-01-14 11:07:54 +01:00
Matus Kral
ad9a57eeaf better snapshot consistency testing during --send-full and -R 2013-01-14 11:06:03 +01:00
Matus Kral
82ff4b2f80 bug fix (wrong recursive filesystem list expansion)
in case of empty filesystem list going for recursive snapshot all
filesystems have been processed
2013-01-14 10:56:49 +01:00
Matus Kral
9bf3d5b017 Revert "bug fix (wrong recursive filesystem list expansion)"
This reverts commit d6c05fb8f4.
2013-01-14 10:37:32 +01:00
Matus Kral
ba171cc032 Revert "bug fix (snapshot list created for destroy in case of incremental send through replication)"
This reverts commit 8b155cf4da.
2013-01-14 10:37:13 +01:00
Matus Kral
8b155cf4da bug fix (snapshot list created for destroy in case of incremental send through replication) 2013-01-14 10:35:32 +01:00
Matus Kral
d6c05fb8f4 bug fix (wrong recursive filesystem list expansion)
in case of empty filesystem list going for recursive snapshot all
filesystems have been processed
2013-01-14 10:35:03 +01:00
Matus Kral
4bbfa476b1 general cleanup, quotations updates etc 2013-01-09 14:17:49 -06:00
Matus Kral
583fc20e28 error return codes renumbering, parameter checking for --send 2013-01-03 14:49:05 -06:00
Matus Kral
2d789bdf1d detection of system (Linux/Darwin). proper detection of mounted snapshots prior to umount.
detection of system applies for local and remote operations. should run
on linux and macosx with no modifications in the code.
2013-01-03 14:49:05 -06:00
Matus Kral
8aaf5f904b issue #8 should be solved by this patch
all filesystems with snapdir=visible and canmount=on are traversed for
snapshots going to be removed and umount -f is called.

on linux, on /proc/mounts such mounted snapshots are visible (not
listed with 'mount'), but under macosx no proc exists, 'mount' again
does not list them so umount -f is called with no mercy for all
specific combination of fs and snapname  (but should not cause any
problems).

there is no specific logic to utilize /proc/mount on linux, same
approach is taken.
2012-12-28 14:14:23 -06:00
Matus Kral
6f91e10033 mktemp on macosx uses some .Xs by default, which is not the case on linux 2012-12-28 14:14:23 -06:00
Matus Kral
1099c622cb comments update 2012-12-27 20:58:22 -06:00
Matus Kral
70632c00b7 going back to standard /bin/sh (bash 3.x on macosx) 2012-12-27 20:58:22 -06:00
Matus Kral
90825db245 README updates 2012-12-27 20:58:22 -06:00
Matus Kral
676ded6217 fix for filesystem expansion when using '//' 2012-12-27 20:58:22 -06:00
Matus Kral
4d20aa4c79 Zevo support. 2012-12-27 20:58:10 -06:00
Darik Horn
cc9f1802ed Fix pool exclusions.
Use $ZPOOL_STATUS instead of $ZFS_STATUS for pool exclusions.

A mistaken variable name made the pool exclusion logic a no-op and
broke the --skip-scrub switch.

Also correct a trivial comment typo.
2012-01-21 16:32:30 -06:00
Darik Horn
d77af5a902 Update the README file to be more descriptive. 2012-01-10 08:10:05 -06:00
Darik Horn
b5bf1149ca Merge pull request #2 from ulope/master
Fixed --prefix and --sep regexes
2011-12-28 10:06:04 -08:00
Ulrich Petri
5fc395c2bb Fixed --prefix and --sep regexes
Fixes: #1
2011-12-28 17:06:34 +01:00
Darik Horn
d99147db7a Set keep=8 in the weekly cron job.
A default of keep=8 for weekly snapshot is more useful than keep=4,
which is no more protective than the default daily schedule.
2011-12-21 20:29:27 -06:00
Darik Horn
c8507a0da9 Change objects to datasets in help and comments.
In the usage synopsis and program comments, change "objects" to
"datasets" for consistency with upstream ZFS terminology.
2011-12-18 07:34:40 -06:00
Darik Horn
74359e51a7 Fix the hourly-daily transposition in the Makefile.
The hourly cron job was installed to cron.daily, and the daily cron
job was installed to cron.hourly, which caused incorrect scheduling.
2011-11-28 00:07:30 -06:00
Darik Horn
afdae86271 Remove redundant lines in the cron.d file. 2011-11-28 00:05:43 -06:00
Darik Horn
4b7609791b Split the cron file for anacron compatibilty.
Split the cron file so that the hourly, daily, weekly, and monthly
zfs automatic snapshots still happen even if the system is offline
temporarily during the scheduled event, such as during a reboot.

On Debian systems, if anacron is installed, then it is used to run
the /etc/cron.{hourly,daily,weekly,monthly} directories, but not
the /etc/cron.d directory. This means that /etc/cron.d jobs are not
run if the system is offline when crond would usually invoke them.
2011-11-25 14:26:08 -06:00
Darik Horn
5ce7a23384 Implement the --event option for :auto-snap-desc.
Set the com.sun:auto-snap-desc property on each snapshot to an
arbitrary value.  On Solaris, this property is set to the dash
character by default -- which is convention for NULL -- but it
can contain an FMRI status comment or other user data.
2011-11-23 10:44:32 -06:00
Darik Horn
2e26499f6a Rebase exit codes to above 127.
Most standard shell utilities return errors less than 128. Rebase the
exit codes of this script to reduce the liklihood of overlap.
2011-11-23 10:03:56 -06:00
Darik Horn
f7ceb28963 Implement --prefix parameter checking.
Also add -p to the getopt list of short options.
2011-11-23 10:00:24 -06:00
Darik Horn
4c14da4130 Consistently quote literal strings.
Apply some syntax hygiene. Quoting everything is a safe habit because
unquoted things can have subtle side-effects.
2011-11-22 23:36:51 -06:00
Darik Horn
249e6a4cb3 Fold the main loops into a do_snapshots function.
The two primary `for` loops were identical except for the '-r' flag.
2011-11-22 23:27:24 -06:00
Darik Horn
a0a43a42af Invert the --skip-scrub test.
The $opt_skip_scrub option was tested incorrectly, which caused
the --skip-scrub option to operate opposite intent.
2011-11-22 22:09:23 -06:00
Darik Horn
d8b1730015 Add an explicit exit 0 to the end of the script.
The implicit return is "$?", which can be set non-zero by
an earlier command.
2011-11-21 21:44:37 -06:00
Darik Horn
adebbd6fee Add -q to the getopt list of short options.
This corresponds to the --quiet option.
2011-11-21 21:40:04 -06:00
10 changed files with 655 additions and 185 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.DS_Store

View File

@@ -2,6 +2,14 @@ all:
install: install:
install -d $(DESTDIR)$(PREFIX)/etc/cron.d install -d $(DESTDIR)$(PREFIX)/etc/cron.d
install etc/zfs-auto-snapshot.cron $(DESTDIR)$(PREFIX)/etc/cron.d/zfs-auto-snapshot install -d $(DESTDIR)$(PREFIX)/etc/cron.daily
install -d $(DESTDIR)$(PREFIX)/etc/cron.hourly
install -d $(DESTDIR)$(PREFIX)/etc/cron.weekly
install -d $(DESTDIR)$(PREFIX)/etc/cron.monthly
install etc/zfs-auto-snapshot.cron.frequent $(DESTDIR)$(PREFIX)/etc/cron.d/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.hourly $(DESTDIR)$(PREFIX)/etc/cron.hourly/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.daily $(DESTDIR)$(PREFIX)/etc/cron.daily/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.weekly $(DESTDIR)$(PREFIX)/etc/cron.weekly/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.monthly $(DESTDIR)$(PREFIX)/etc/cron.monthly/zfs-auto-snapshot
install -d $(DESTDIR)$(PREFIX)/sbin install -d $(DESTDIR)$(PREFIX)/sbin
install src/zfs-auto-snapshot.sh $(DESTDIR)$(PREFIX)/sbin/zfs-auto-snapshot install src/zfs-auto-snapshot.sh $(DESTDIR)$(PREFIX)/sbin/zfs-auto-snapshot

12
README
View File

@@ -1,4 +1,14 @@
An alternative implementation of the zfs-auto-snapshot service for Linux. zfs-auto-snapshot:
An alternative implementation of the zfs-auto-snapshot service for Macosx
that is compatible with ZEVO community zfs.
Automatically create, rotate, and destroy periodic ZFS snapshots. This is
the utility that creates the @zfs-auto-snap_frequent, @zfs-auto-snap_hourly,
@zfs-auto-snap_daily, @zfs-auto-snap_weekly, and @zfs-auto-snap_monthly
snapshots if it is installed.
It can backup to remote systems utilizing zfs send command.
This program is a posixly correct bourne shell script. It depends only on 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. the zfs utilities and cron, and can run in the dash shell.

View File

@@ -1,7 +0,0 @@
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
*/15 * * * * root zfs-auto-snapshot -q -g --label=frequent --keep=4 //
@hourly root zfs-auto-snapshot -q -g --label=hourly --keep=24 //
@daily root zfs-auto-snapshot -q -g --label=daily --keep=31 //
@weekly root zfs-auto-snapshot -q -g --label=weekly --keep=4 //
@monthly root zfs-auto-snapshot -q -g --label=monthly --keep=12 //

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec zfs-auto-snapshot --quiet --syslog --label=daily --keep=31 //

View File

@@ -0,0 +1,3 @@
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
*/15 * * * * root zfs-auto-snapshot -q -g --label=frequent --keep=4 //

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec zfs-auto-snapshot --quiet --syslog --label=hourly --keep=24 //

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec zfs-auto-snapshot --quiet --syslog --label=monthly --keep=12 //

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec zfs-auto-snapshot --quiet --syslog --label=weekly --keep=8 //

File diff suppressed because it is too large Load Diff