backup-script.git
8 weeks agobackup-audit: Exclude quota status files in / directory master
Alexander Barton [Wed, 27 Mar 2019 13:07:41 +0000 (14:07 +0100)]
backup-audit: Exclude quota status files in / directory

8 weeks agobackup-audit: Enhance checking of systemd configuration
Alexander Barton [Wed, 27 Mar 2019 13:07:21 +0000 (14:07 +0100)]
backup-audit: Enhance checking of systemd configuration

This introduces the new ListFilesRecursive() function. Problem is, that
time stamps of systemd unit files etc. often change when systemd settings
are updated -- even when the file itself doesn't change. So just compare
the file names, not the time stamps etc.

2 months agobackup-audit: Fix shellcheck SC2196, dont use "egrep"
Alexander Barton [Wed, 6 Mar 2019 14:18:08 +0000 (15:18 +0100)]
backup-audit: Fix shellcheck SC2196, dont use "egrep"

egrep is non-standard and deprecated. Use grep -E instead.

3 months agobackup-audit: Add some more systemd-related paths to check
Alexander Barton [Tue, 12 Feb 2019 16:21:12 +0000 (17:21 +0100)]
backup-audit: Add some more systemd-related paths to check

5 months agobackup-audit: Don't skip systems with errors, only print a warning
Alexander Barton [Mon, 3 Dec 2018 10:48:28 +0000 (11:48 +0100)]
backup-audit: Don't skip systems with errors, only print a warning

14 months agobackup-audit: Use find(1) instead of ls(1) to get more comparable output
Alexander Barton [Fri, 23 Feb 2018 10:03:33 +0000 (11:03 +0100)]
backup-audit: Use find(1) instead of ls(1) to get more comparable output

Using ls, the column widths aren't stable, for example ...

15 months agobackup-audit: Add system "service" directories
Alexander Barton [Thu, 1 Feb 2018 08:49:20 +0000 (09:49 +0100)]
backup-audit: Add system "service" directories

16 months agoRedirect stderr of scp(1) to stdout to not indicate errors github/master
Alexander Barton [Wed, 10 Jan 2018 10:52:11 +0000 (11:52 +0100)]
Redirect stderr of scp(1) to stdout to not indicate errors

Some warning messages of scp(1) are written to stderr (like "Connection
to ... closed by remote host."), even when there is no error and the
exit code is 0 ("no error"). Therefore redirect stderr to stdout to not
confuse "mail wrapper scripts" that see output on stderr otherwise.

16 months agobackup-script: Fix two warnings of shellcheck(1)
Alexander Barton [Wed, 10 Jan 2018 10:38:19 +0000 (11:38 +0100)]
backup-script: Fix two warnings of shellcheck(1)

ID [SC1117]:
'Backslash is literal in "\n". Prefer explicit escaping: "\\n".'

17 months agoGet rid of "echo -n" and bogus "ErrorMsg -n"
Alexander Barton [Mon, 4 Dec 2017 12:53:53 +0000 (13:53 +0100)]
Get rid of "echo -n" and bogus "ErrorMsg -n"

This fixes garbled output like this:

   -n
   Aborted:
   Sat Dec  2 20:45:02 CET 2017

17 months agoDon't set "pipefail", it changes behaviour!
Alexander Barton [Fri, 1 Dec 2017 10:44:28 +0000 (11:44 +0100)]
Don't set "pipefail", it changes behaviour!

Using "pipefail" is a good idea (fail early), but changes behaviour
and leeds to undesired side-effects when commands exit because of the
PIPEFAIL signal (exit code 141).

References:
 - https://stackoverflow.com/questions/19120263/why-exit-code-141-with-grep-q
 - http://www.tldp.org/LDP/lpg/node20.html
 - http://www.pixelbeat.org/programming/sigpipe_handling.html

This partially reverts commit 2177f5af642e.

18 months agoEnable shell options for safer execution environment
Alexander Barton [Mon, 20 Nov 2017 11:15:12 +0000 (12:15 +0100)]
Enable shell options for safer execution environment

18 months agoOutput warning and error messages to stderr
Alexander Barton [Mon, 13 Nov 2017 16:40:55 +0000 (17:40 +0100)]
Output warning and error messages to stderr

This allows to filter warning/error messages more easily.

18 months agoFix "make check", redirect stderr to stdout to make grep work
Alexander Barton [Mon, 13 Nov 2017 16:39:48 +0000 (17:39 +0100)]
Fix "make check", redirect stderr to stdout to make grep work

And use "grep -F" instead of "fgrep".

2 years agoRespect "dry run mode" when continuing snapshots
Alexander Barton [Tue, 18 Apr 2017 10:16:31 +0000 (12:16 +0200)]
Respect "dry run mode" when continuing snapshots

And don't rename the snapshot to the new name, no write access!

2 years agoFix shellcheck(1) warning SC2197
Alexander Barton [Tue, 18 Apr 2017 09:59:28 +0000 (11:59 +0200)]
Fix shellcheck(1) warning SC2197

"fgrep is non-standard and deprecated. Use grep -F instead."

2 years agoFix shellcheck(1) warning SC2181
Alexander Barton [Tue, 18 Apr 2017 09:58:41 +0000 (11:58 +0200)]
Fix shellcheck(1) warning SC2181

"Check exit code directly with e.g. 'if mycmd;', not indirectly with $?."

2 years agobackup-status: Ignore disabled jobs when listing jobs with errors
Alexander Barton [Wed, 14 Dec 2016 13:43:56 +0000 (14:43 +0100)]
backup-status: Ignore disabled jobs when listing jobs with errors

2 years agoFurther enhance README.md, add "Installation" section
Alexander Barton [Mon, 24 Oct 2016 12:31:29 +0000 (14:31 +0200)]
Further enhance README.md, add "Installation" section

2 years agoUnify and enhance usage information and script descriptions
Alexander Barton [Mon, 24 Oct 2016 12:30:55 +0000 (14:30 +0200)]
Unify and enhance usage information and script descriptions

2 years agoFix shellcheck(1) warning SC2181: "Check exit code directly"
Alexander Barton [Mon, 24 Oct 2016 10:58:19 +0000 (12:58 +0200)]
Fix shellcheck(1) warning SC2181: "Check exit code directly"

See <https://github.com/koalaman/shellcheck/wiki/SC2181> for details.

2 years agoREADME.md: Use "job definition" instead of "system definition"
Alexander Barton [Mon, 24 Oct 2016 09:19:33 +0000 (11:19 +0200)]
README.md: Use "job definition" instead of "system definition"

2 years agoFix README.md, and add link to "homepage" at GitHub
Alexander Barton [Mon, 24 Oct 2016 09:18:39 +0000 (11:18 +0200)]
Fix README.md, and add link to "homepage" at GitHub

2 years agobackup-script: Implement "-x"/"--no-exec" command line option
Alexander Barton [Fri, 21 Oct 2016 10:25:14 +0000 (12:25 +0200)]
backup-script: Implement "-x"/"--no-exec" command line option

When this option is given, neither the global "setup-exec", "pre-exec",
nor the global "post-exec" coammds will be run.

2 years agobackup-script-wrapper: Add "success" to mail subject when everything is ok
Alexander Barton [Mon, 12 Sep 2016 15:33:23 +0000 (17:33 +0200)]
backup-script-wrapper: Add "success" to mail subject when everything is ok

2 years agobackup-audit: Enhance listing of directory changes
Alexander Barton [Wed, 17 Aug 2016 13:39:28 +0000 (15:39 +0200)]
backup-audit: Enhance listing of directory changes

2 years agobackup-audit: Exclude /proc, /sys, and /net
Alexander Barton [Fri, 22 Jul 2016 13:03:40 +0000 (15:03 +0200)]
backup-audit: Exclude /proc, /sys, and /net

2 years agobackup-audit: Check for changes in some directory contents
Alexander Barton [Wed, 20 Jul 2016 08:24:31 +0000 (10:24 +0200)]
backup-audit: Check for changes in some directory contents

2 years agobackup-audit: Update list of files to check
Alexander Barton [Wed, 20 Jul 2016 08:21:54 +0000 (10:21 +0200)]
backup-audit: Update list of files to check

2 years agobackup-audit: Don't append ”/" when checking directories manually
Alexander Barton [Wed, 20 Jul 2016 07:53:36 +0000 (09:53 +0200)]
backup-audit: Don't append ”/" when checking directories manually

2 years agobackup-audit: Add more files to the checklist
Alexander Barton [Mon, 18 Jul 2016 16:33:48 +0000 (18:33 +0200)]
backup-audit: Add more files to the checklist

2 years agoCatch SIGTERM as well as SIGINT
Alexander Barton [Wed, 13 Jul 2016 13:29:51 +0000 (15:29 +0200)]
Catch SIGTERM as well as SIGINT

2 years agoFix and mark several notices & warnings of shellcheck(1)
Alexander Barton [Tue, 12 Jul 2016 10:23:19 +0000 (12:23 +0200)]
Fix and mark several notices & warnings of shellcheck(1)

2 years agobackup-audit: Suppress error message when no older generation exists
Alexander Barton [Fri, 8 Jul 2016 08:03:05 +0000 (10:03 +0200)]
backup-audit: Suppress error message when no older generation exists

2 years agoDon't clean up when "setup_exec" command failed
Alexander Barton [Wed, 6 Jul 2016 14:33:20 +0000 (16:33 +0200)]
Don't clean up when "setup_exec" command failed

2 years agobackup-script-wrapper: Don't check lockfile on its own
Alexander Barton [Wed, 6 Jul 2016 14:18:57 +0000 (16:18 +0200)]
backup-script-wrapper: Don't check lockfile on its own

This is done by the "backup-script" already, don't duplicate logic.
And in addition this leads to streamlined error reporting.

2 years agoImplement global "setup_exec" configuration option
Alexander Barton [Wed, 6 Jul 2016 14:17:58 +0000 (16:17 +0200)]
Implement global "setup_exec" configuration option

2 years agoAdd "backup-audit" script
Alexander Barton [Mon, 4 Jul 2016 14:25:03 +0000 (16:25 +0200)]
Add "backup-audit" script

This script compares backup generations and shows "relevant" changes
in the system configuration.

At the moment this includes changes to some system files and in the
list of installed (Debian-) packages. More to come!

2 years agoSlightly enhance "make check" ...
Alexander Barton [Mon, 4 Jul 2016 14:14:39 +0000 (16:14 +0200)]
Slightly enhance "make check" ...

2 years agoREADME.md: Slightly enhance backup-script-wrapper usage information
Alexander Barton [Mon, 4 Jul 2016 14:10:48 +0000 (16:10 +0200)]
README.md: Slightly enhance backup-script-wrapper usage information

2 years agoImplement new "backup_type": "disabled"
Alexander Barton [Wed, 1 Jun 2016 09:24:04 +0000 (11:24 +0200)]
Implement new "backup_type": "disabled"

2 years agoImplement very trivial first "make check" tests
Alexander Barton [Wed, 25 May 2016 08:25:57 +0000 (10:25 +0200)]
Implement very trivial first "make check" tests

2 years agoNew configuration variable "[default_]io_timeout"
Alexander Barton [Wed, 25 May 2016 08:25:01 +0000 (10:25 +0200)]
New configuration variable "[default_]io_timeout"

Tis allows setting of the maximum I/O timeout in seconds. If no data
is transferred for the specified time then rsync will abort.

This patch also changes the default from 900 to 1800 seconds (30 min).

3 years agoSet rsync I/O timeout to 15 minutes
Alexander Barton [Fri, 20 May 2016 12:30:25 +0000 (14:30 +0200)]
Set rsync I/O timeout to 15 minutes

3 years agoUser rsync option "--delete-during"
Alexander Barton [Fri, 20 May 2016 12:16:27 +0000 (14:16 +0200)]
User rsync option "--delete-during"

3 years agobackup-script-wrapper: Show command line
Alexander Barton [Wed, 4 May 2016 11:58:15 +0000 (13:58 +0200)]
backup-script-wrapper: Show command line

3 years agoFix code that makes sure "source_root" ends with a slash
Alexander Barton [Thu, 28 Apr 2016 11:33:25 +0000 (13:33 +0200)]
Fix code that makes sure "source_root" ends with a slash

The correct variable is "source_root" (not "source", which isn't used by
subsequent commands in the script), and the code has been bogus anyway ...

3 years agoCorrectly initialize system array when specific systems are given
Alexander Barton [Thu, 28 Apr 2016 09:07:33 +0000 (11:07 +0200)]
Correctly initialize system array when specific systems are given

3 years agoFix some warning messages of shellcheck(1)
Alexander Barton [Tue, 26 Apr 2016 14:54:45 +0000 (16:54 +0200)]
Fix some warning messages of shellcheck(1)

- SC1090: Can't follow non-constant source. Use a directive to
  specify location.

- SC2125: Brace expansions and globs are literal in assignments.
  Quote it or use an array.

- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.

See <http://www.shellcheck.net>.

3 years agoImplement job tagging
Alexander Barton [Tue, 19 Apr 2016 15:48:33 +0000 (17:48 +0200)]
Implement job tagging

Introduce new command line option "-t TAG"/"--tags TAG" and new job
option "[default_]tags".

3 years agoREADME.md: It is [default_]files (not "file"), plural!
Alexander Barton [Wed, 17 Feb 2016 16:13:13 +0000 (17:13 +0100)]
README.md: It is [default_]files (not "file"), plural!

3 years agoUpdate copyright notices for 2016
Alexander Barton [Tue, 5 Jan 2016 08:52:13 +0000 (09:52 +0100)]
Update copyright notices for 2016

3 years agoDisable "globbing" for exclude patterns
Alexander Barton [Thu, 4 Feb 2016 13:09:24 +0000 (14:09 +0100)]
Disable "globbing" for exclude patterns

3 years agoShow generation config in "nothing to cleanup" message
Alexander Barton [Tue, 29 Dec 2015 09:11:05 +0000 (10:11 +0100)]
Show generation config in "nothing to cleanup" message

3 years agoFix backup-status not showing result code for successful backups
Alexander Barton [Tue, 24 Nov 2015 15:11:10 +0000 (16:11 +0100)]
Fix backup-status not showing result code for successful backups

This bug has been introduced by commit e9d32c68 ("backup-status: Show
more information from stamp file"). Oops!

3 years agobackup-status: Show more information from stamp file
Alexander Barton [Tue, 24 Nov 2015 13:18:13 +0000 (14:18 +0100)]
backup-status: Show more information from stamp file

3 years agoWrite more information to "stamp file"
Alexander Barton [Tue, 24 Nov 2015 13:17:52 +0000 (14:17 +0100)]
Write more information to "stamp file"

3 years agoUpdate trial run message, don't call it "synchronization command"
Alexander Barton [Tue, 24 Nov 2015 12:21:53 +0000 (13:21 +0100)]
Update trial run message, don't call it "synchronization command"

3 years agobackup-status: Enhance status message
Alexander Barton [Tue, 24 Nov 2015 12:03:58 +0000 (13:03 +0100)]
backup-status: Enhance status message

3 years agoImplement "scp" backup type
Alexander Barton [Wed, 18 Nov 2015 16:12:20 +0000 (17:12 +0100)]
Implement "scp" backup type

This backup type is handy to save router configuration files, for
example. The defaults are suitable for Cisco IOS devices.

3 years agoFirst step to support multiple "backup types"
Alexander Barton [Wed, 18 Nov 2015 15:27:34 +0000 (16:27 +0100)]
First step to support multiple "backup types"

3 years agoFix more warnings of shellcheck(1), use "[[ ... ]]" instead of "[ ... ]"
Alexander Barton [Wed, 18 Nov 2015 15:26:09 +0000 (16:26 +0100)]
Fix more warnings of shellcheck(1), use "[[ ... ]]" instead of "[ ... ]"

3 years agoFix two warnings of shellcheck(1)
Alexander Barton [Wed, 18 Nov 2015 15:24:45 +0000 (16:24 +0100)]
Fix two warnings of shellcheck(1)

3 years agobackup-status: Implement "--errors" to only list backups with errors
Alexander Barton [Mon, 5 Oct 2015 08:41:42 +0000 (10:41 +0200)]
backup-status: Implement "--errors" to only list backups with errors

3 years agobackup-status: Reformat usage information
Alexander Barton [Mon, 5 Oct 2015 08:40:58 +0000 (10:40 +0200)]
backup-status: Reformat usage information

3 years agoUpdate usage information, add [-|--latest]
Alexander Barton [Mon, 5 Oct 2015 08:19:40 +0000 (10:19 +0200)]
Update usage information, add [-|--latest]

3 years agoUse relative symlinks for ZFS snapshots
Alexander Barton [Thu, 1 Oct 2015 12:43:47 +0000 (14:43 +0200)]
Use relative symlinks for ZFS snapshots

This eases renaming of systems etc.

3 years agorsync: Use better progress output when available (protocol version >=31)
Alexander Barton [Thu, 1 Oct 2015 12:37:40 +0000 (14:37 +0200)]
rsync: Use better progress output when available (protocol version >=31)

3 years agoDetect rsync and its protocol version
Alexander Barton [Thu, 1 Oct 2015 12:27:39 +0000 (14:27 +0200)]
Detect rsync and its protocol version

3 years agoDefault system excludes: Only exclude content, not directory itself
Alexander Barton [Mon, 21 Sep 2015 12:09:04 +0000 (14:09 +0200)]
Default system excludes: Only exclude content, not directory itself

3 years agoRefactor list of default excludes for system backups
Alexander Barton [Mon, 21 Sep 2015 11:57:35 +0000 (13:57 +0200)]
Refactor list of default excludes for system backups

3 years agoAdd "[default_]exclude_dirs_add" options
Alexander Barton [Mon, 21 Sep 2015 11:48:50 +0000 (13:48 +0200)]
Add "[default_]exclude_dirs_add" options

3 years agobackup-status: Backup directory uses configuration file name
Alexander Barton [Mon, 21 Sep 2015 10:27:12 +0000 (12:27 +0200)]
backup-status: Backup directory uses configuration file name

3 years agobackup-status: Don't read ${conf_d}/backup-script.conf twice
Alexander Barton [Mon, 21 Sep 2015 10:26:40 +0000 (12:26 +0200)]
backup-status: Don't read ${conf_d}/backup-script.conf twice

3 years agobackup-status: Use /var/backups as default backup target
Alexander Barton [Mon, 24 Aug 2015 08:39:15 +0000 (10:39 +0200)]
backup-status: Use /var/backups as default backup target

This has been implemented in commit 1af443845d1f for "backup-script",
so implement it for "backup-status", too!

3 years agoFilesystem summary: Use "zfs list" on ZFS filesystems
Alexander Barton [Mon, 24 Aug 2015 08:24:41 +0000 (10:24 +0200)]
Filesystem summary: Use "zfs list" on ZFS filesystems

3 years agoRead in configuration before showing usage information
Alexander Barton [Thu, 20 Aug 2015 14:55:05 +0000 (16:55 +0200)]
Read in configuration before showing usage information

And show more configuration details on regular runs, too.

3 years agobackup-script-wrapper: Check for PID file ("lock file")
Alexander Barton [Wed, 19 Aug 2015 08:19:59 +0000 (10:19 +0200)]
backup-script-wrapper: Check for PID file ("lock file")

Check for the existence of the PID and abort if if exists file before
redirecting the output to the log file, to not garble it when an other
instance is still running.

3 years agobackup-script-wrapper: Sort variables alphabetically
Alexander Barton [Wed, 19 Aug 2015 08:18:18 +0000 (10:18 +0200)]
backup-script-wrapper: Sort variables alphabetically

3 years agobackup-status: Implement new "--latest" option
Alexander Barton [Wed, 19 Aug 2015 08:13:29 +0000 (10:13 +0200)]
backup-status: Implement new "--latest" option

3 years agobackup-status: Refactor argument parsing
Alexander Barton [Wed, 19 Aug 2015 08:06:33 +0000 (10:06 +0200)]
backup-status: Refactor argument parsing

3 years agobackup-status: Correctly show "current" snapshot as newest
Alexander Barton [Wed, 19 Aug 2015 07:59:25 +0000 (09:59 +0200)]
backup-status: Correctly show "current" snapshot as newest

3 years agobackup-status: Use "poster -ap" when "--running" finds a running job
Alexander Barton [Tue, 18 Aug 2015 14:27:23 +0000 (16:27 +0200)]
backup-status: Use "poster -ap" when "--running" finds a running job

3 years agobackup-status: Implement "--running" option
Alexander Barton [Tue, 18 Aug 2015 14:22:26 +0000 (16:22 +0200)]
backup-status: Implement "--running" option

This option checks if a backup is running at the moment (exit code 0)
or not (exit code 1).

3 years agobackup-status: Remove unused variables
Alexander Barton [Tue, 18 Aug 2015 14:02:13 +0000 (16:02 +0200)]
backup-status: Remove unused variables

"local" and "destdir" seem to be unused?

3 years agobackup-status: Correctly quote and initialize variables
Alexander Barton [Tue, 18 Aug 2015 14:01:48 +0000 (16:01 +0200)]
backup-status: Correctly quote and initialize variables

3 years agobackup-status: Use exit code 2 when displaying usage information
Alexander Barton [Tue, 18 Aug 2015 10:24:16 +0000 (12:24 +0200)]
backup-status: Use exit code 2 when displaying usage information

3 years agobackup-status: Use same configuration search order than backup-script
Alexander Barton [Tue, 18 Aug 2015 10:23:50 +0000 (12:23 +0200)]
backup-status: Use same configuration search order than backup-script

3 years agobackup-script-wrapper: Show non-zero exit code in mail subject
Alexander Barton [Tue, 18 Aug 2015 09:22:05 +0000 (11:22 +0200)]
backup-script-wrapper: Show non-zero exit code in mail subject

3 years agobackup-script-wrapper: Use FQDN for mail subject
Alexander Barton [Tue, 18 Aug 2015 09:21:16 +0000 (11:21 +0200)]
backup-script-wrapper: Use FQDN for mail subject

3 years agobackup-script-wrapper: Write a "delimiter line" to the log file
Alexander Barton [Tue, 18 Aug 2015 09:14:25 +0000 (11:14 +0200)]
backup-script-wrapper: Write a "delimiter line" to the log file

3 years agoREADME.md: Update "configuration" section
Alexander Barton [Tue, 18 Aug 2015 09:09:00 +0000 (11:09 +0200)]
README.md: Update "configuration" section

3 years agoExit with code 7 when not all jobs have been run
Alexander Barton [Tue, 18 Aug 2015 09:08:38 +0000 (11:08 +0200)]
Exit with code 7 when not all jobs have been run

3 years agoStreamline and document exit codes
Alexander Barton [Tue, 18 Aug 2015 09:08:03 +0000 (11:08 +0200)]
Streamline and document exit codes

3 years agoReturn exit code 1 on errors!
Alexander Barton [Tue, 18 Aug 2015 08:48:03 +0000 (10:48 +0200)]
Return exit code 1 on errors!

3 years agobackup-script-wrapper: Return exit code of backup-script
Alexander Barton [Tue, 18 Aug 2015 08:46:21 +0000 (10:46 +0200)]
backup-script-wrapper: Return exit code of backup-script

3 years agobackup-script-wrapper: Use bash
Alexander Barton [Tue, 18 Aug 2015 08:46:04 +0000 (10:46 +0200)]
backup-script-wrapper: Use bash

backup-script itself already uses /bin/bash, so we don't loose portability.
And now we can use nice bash features in the future ;-)

3 years agoDisable compression for the local system
Alexander Barton [Tue, 18 Aug 2015 08:41:37 +0000 (10:41 +0200)]
Disable compression for the local system

3 years agoUse /usr/local/etc/backup-script.conf by default (not /etc/...)
Alexander Barton [Tue, 18 Aug 2015 08:35:59 +0000 (10:35 +0200)]
Use /usr/local/etc/backup-script.conf by default (not /etc/...)

3 years agoUse /var/backups as default backup target
Alexander Barton [Tue, 18 Aug 2015 08:32:49 +0000 (10:32 +0200)]
Use /var/backups as default backup target