Code: Select all
!/bin/bash
#/**
# * @file run.sh
# */
# remove guide.xml
cd /home/pi/wg++
rm guide.xml
#backup the current working dir
WG_BCKP_DIR="$(pwd)"
function quit {
#restore previous working dir
cd "$WG_BCKP_DIR"
exit $1;
}
# check if mono can be found
which mono >/dev/null 2>&1 || { echo >&2 "Mono required, but it's not installed."; quit 1; }
# get the absolute path of the link (or relative path)
if [ -L $0 ] ; then
DIR=$(dirname $(readlink -f $0)) ;
else
DUTDIR=$(dirname $0) ;
if [ "${DUTDIR:0:1}" = "/" ]; then
DIR="$DUTDIR";
else
DIR=$PWD/$(dirname $0) ;
fi
fi ;
mono "$DIR/bin/WebGrab+Plus.exe" "$DIR"
Im trying to get this to run via a crontab on certain days.
My crontab ran under 'root' is
0 2 * * 1,3,5,7 /home/pi/wg++/run.sh > /home/pi/wg++/backup.log 2>&1
The crontab runs fine when it should at the correct time,day etc but the bash script doesnt execute correctly. I get an error saying 'Mono required, but it's not installed'. It seems like when its ran through crontab it doesnt think mono is installed on the pi.
Any ideas please?