From a7bf628e6129254d0abb47e00fbb0df2d588cf34 Mon Sep 17 00:00:00 2001 From: Elijah Saxon Date: Sun, 26 Dec 2004 11:19:06 +0000 Subject: added scheduling (!) see readme. --- backupninja | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 97 insertions(+), 8 deletions(-) (limited to 'backupninja') 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