That did not do the trick.
This is the script: (It does not seem to execute, but cron shows it ran.
The backup script works fine via cron, but does not get executed when
called from this script)
#!/bin/bash
HOST="windowshostname"
CMD="ping -c1 $HOST"
CMD_RET=`$CMD`
# echo $CMD_RET
NOWDATE=`date +%Y%m%d`
if [ -f ping_check.txt ];
then
FILEDATE=`cat ping_check.txt`
else
FILEDATE=0
fi
if [ $NOWDATE -ne $FILEDATE ];
then
if [[ $CMD_RET =~ ", 0% packet loss" ]]
then
echo "$HOST pinged ..."
echo $NOWDATE > ping_check.txt
# run backup script
else
echo "$HOST did not ping ..."
fi
fi
exit
On 01/04/2011 04:24 PM, Smith, Craig A wrote:
> Raymond Norton wrote:
>
>
>> I tried appending> /dev/null, but can't get it to run like it does from the command line.
>>
>
> Does it send an annoying email every time it runs?
>
> If so, try adding \;> /dev/null 2>&1
> to the end of crontab entry.
>
> For example:
>
> 1-59/10 * * * * /path-to-script/scrip.sh \;> /dev/null 2>&1
>
> will silently run the script every 10min.
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>
>