From: Elijah Saxon Date: Sun, 26 Dec 2004 11:19:06 +0000 (+0000) Subject: added scheduling (!) see readme. X-Git-Tag: backupninja-0.4.0 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=a7bf628e6129254d0abb47e00fbb0df2d588cf34;p=matthijs%2Fupstream%2Fbackupninja.git added scheduling (!) see readme. --- diff --git a/README b/README index 5a5a2a8..e361ba7 100644 --- a/README +++ b/README @@ -28,6 +28,7 @@ The following options are available: -f Use for the main configuration instead of /etc/backupninja.conf + CONFIGURATION FILES =================== @@ -77,6 +78,42 @@ For example: pear = no thanks \ i will not have a pear. + +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 config +file. + +For example: + + when = sundays at 02:00 + when = 30th at 22 + when = 30 at 22:00 + when = everyday at 01 <-- the default + when = Tuesday at 05:00 + +A configuration file will be processed at the time(s) specified by the +"when" option. If multiple "when" options are present, then they all +apply. If two configurations files are scheduled to run in the same +hour, then we fall back on the alphabetical ordering specified above. +If two configurations files are scheduled close to one another in +time, it is possible to have multiple copies of backupninja running if +the first instance is not finished before the next one starts. + +These values for 'when' are equivalent: + + when = tuesday at 05:30 + when = TUESDAYS at 05 + +These values for 'when' are invalid: + + when = tuesday at 2am + when = tuesday at 2 + when = tues at 02 + + REAL WORLD USAGE ================ @@ -101,6 +138,7 @@ the backup server must have root on the production server, and (3) rdiff-backup is more space efficient and featureful than using rsync + hard links. + SSH KEYS ======== @@ -117,6 +155,7 @@ user 'backup' on desthost without specifying a password. Note: when prompted for a password by ssh-keygen, just leave it blank by hitting return. + INSTALLATION ============ diff --git a/backupninja b/backupninja index 921cb96..c8764ab 100755 --- a/backupninja +++ b/backupninja @@ -133,6 +133,77 @@ function getconf() { eval $1='$ret' } +# +# enforces very strict permissions on configuration file $file. +# + +function check_perms() { + local file=$1 + local perms=`ls -ld $file` + perms=${perms:4:6} + if [ "$perms" != "------" ]; then + fatal "Configuration files must not be group or world readable! Dying on file $file" + fi + if [ `ls -ld $file | awk '{print $3}'` != "root" ]; then + fatal "Configuration files must be owned by root! Dying on file $file" + fi +} + +# simple lowercase function +function tolower() { + echo "$1" | tr [:upper:] [:lower:] +} + +# simple to integer function +function toint() { + echo "$1" | tr [:alpha:] -d +} + +# +# function isnow(): returns 1 if the time/day passed as $1 matches +# the current time/day. +# +# format is at