function logmsg() {
if [ -w "$logfile" ]; then
- echo -e `date "+%h %d %H:%M:%S"` "$@" >> $logfile
+ echo -e `LC_ALL=C date "+%h %d %H:%M:%S"` "$@" >> $logfile
fi
}
# simple lowercase function
function tolower() {
- echo "$1" | tr [:upper:] [:lower:]
+ echo "$1" | tr '[:upper:]' '[:lower:]'
}
# simple to integer function
# we grab the current time once, since processing
# all the configs might take more than an hour.
-nowtime=`date +%H`
-nowday=`date +%d`
-nowdayofweek=`date +%A`
+nowtime=`LC_ALL=C date +%H`
+nowday=`LC_ALL=C date +%d`
+nowdayofweek=`LC_ALL=C date +%A`
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"`
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
previous=""
for i in $(ls "$configdirectory"); do
backuploc=$(grep ^directory "$configdirectory"/"$i" | @AWK@ '{print $3}')
- if [ "$backuploc" != "$previous" ]; then
+ if [ "$backuploc" != "$previous" -a -n "$backuploc" ]; then
df -h "$backuploc"
previous="$backuploc"
fi