From a1c625fcc3c1bdcc81bb23aee3bea95051d6cc20 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 12 Jan 2009 22:47:08 +0000 Subject: [PATCH] add support for 'when = manual' (Closes: #511299) --- AUTHORS | 1 + ChangeLog | 3 +++ man/backup.d.5 | 3 ++- src/backupninja.in | 7 +++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1d852cf..dc0d2bd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -28,3 +28,4 @@ romain.tartiere@healthgrid.org -- ldap fixes Adam Monsen - spec file updates Matthew Palmer -- halt loglevel feature dan@garthwaite.org -- reportspace bugfix +Tuomas Jormola -- "when = manual" option diff --git a/ChangeLog b/ChangeLog index 87d3284..58ae954 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ version 0.9.7 -- UNRELEASED backupninja changes . fix bug in reportspace, thanks Dan Garthwaite . do not assume English locale when using date (Closes: #465837) + . add 'when = manual' option, that can be used in the global config + file or in a given backup action file. Thanks Tuomas Jormola for the + preliminary patch (Closes: #511299) handler changes maildir: . fix location of deleted_on file diff --git a/man/backup.d.5 b/man/backup.d.5 index 5090051..fd5c9b2 100644 --- a/man/backup.d.5 +++ b/man/backup.d.5 @@ -67,7 +67,7 @@ Example templates for the action configuration files can be found in /usr/share/ .SH SCHEDULING -By default, each configuration file is processed everyday at 01:00 (1 AM). This can be changed by specifying the 'when' option in a backup action's config file or in the global configuration file. +By default, each configuration file is processed everyday at 01:00 (1 AM). This can be changed by specifying the 'when' option in a backup action's config file or in the global configuration file. Special value 'manual' will disable scheduling for the backup action. It is possible to run the backup action manually by invoking \fBninjahelper(1)\fP with --run command line argument. For example: when = sundays at 02:00 @@ -76,6 +76,7 @@ For example: when = everyday at 01 when = Tuesday at 05:00 when = hourly + when = manual These values for "when" are invalid: when = tuesday at 2am diff --git a/src/backupninja.in b/src/backupninja.in index 6dee3b6..2a1b76e 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -208,6 +208,9 @@ nowdayofweek=`tolower "$nowdayofweek"` function isnow() { local when="$1" set -- $when + + [ "$when" == "manual" ] && return 0 + whendayofweek=$1; at=$2; whentime=$3; whenday=`toint "$whendayofweek"` whendayofweek=`tolower "$whendayofweek"` @@ -298,9 +301,9 @@ function process_action() { ret=$? IFS=$'\t\n' if [ $ret == 0 ]; then - debug "skipping $file because it is not $w" + debug "skipping $file because current time does not match $w" else - info ">>>> starting action $file (because it is $w)" + info ">>>> starting action $file (because current time matches $w)" run="yes" fi done -- 2.30.2