- if [ "$usecolor" == "yes" ]; then
+ if [ "$usecolors" == "yes" ]; then
local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
[ "$typestr" == "Debug" ] && type=0
[ "$typestr" == "Info" ] && type=1
local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'`
[ "$typestr" == "Debug" ] && type=0
[ "$typestr" == "Info" ] && type=1
# used to capture output from handlers
echo_debug_msg=0
# used to capture output from handlers
echo_debug_msg=0
function printmsg() {
[ ${#@} -gt 1 ] || return
function printmsg() {
[ ${#@} -gt 1 ] || return
# replace * with %, so that it is not globbed.
ret="${ret//\\*/__star__}"
# replace * with %, so that it is not globbed.
ret="${ret//\\*/__star__}"
+ ret="${ret//\*/__star__}"
# this is weird, but single quotes are needed to
# allow for returned values with spaces. $ret is still expanded
# this is weird, but single quotes are needed to
# allow for returned values with spaces. $ret is still expanded
-t, --test Run in test mode, no actions are actually taken.
-n, --now Perform actions now, instead of when they
might be scheduled.
-t, --test Run in test mode, no actions are actually taken.
-n, --now Perform actions now, instead of when they
might be scheduled.
+ --run FILE Execute the specified action file and then exit.
When using colored output, there are:
EOF
debug=1
When using colored output, there are:
EOF
debug=1
# we shift here to avoid processing the file path
shift
;;
# we shift here to avoid processing the file path
shift
;;
if [ -f $2 ]; then
singlerun=$2
processnow=1
if [ -f $2 ]; then
singlerun=$2
processnow=1
else
fatal "--run option must be fallowed by a backupninja action file"
usage
else
fatal "--run option must be fallowed by a backupninja action file"
usage
fatal "Unknown option $1"
usage
fatal "Unknown option $1"
usage
+#if [ $debug ]; then
+# usercolors=yes
+#fi
+
## Load and confirm basic configuration values
# bootstrap
## Load and confirm basic configuration values
# bootstrap
if [ "$singlerun" ]; then
files=$singlerun
else
if [ "$singlerun" ]; then
files=$singlerun
else
- files=`ls $configdirectory`
+ files=`find $configdirectory -mindepth 1 `
fi
for file in $files; do
fi
for file in $files; do
- [ -f $file ] || continue;
+ [ -f "$file" ] || continue
check_perms $file
suffix="${file##*.}"
check_perms $file
suffix="${file##*.}"
msg "*missing handler* -- $file"
fi
done
msg "*missing handler* -- $file"
fi
done
## mail the messages to the report address
if [ $actions_run == 0 ]; then doit=0
## mail the messages to the report address
if [ $actions_run == 0 ]; then doit=0