add a +x to the first line "#!/bin/bash -x" and run the script.<br><br><div class="gmail_quote">On Tue, Jan 4, 2011 at 6:40 PM, Raymond Norton <span dir="ltr"><<a href="mailto:admin@lctn.org">admin@lctn.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">That did not do the trick.<br>
<br>
This is the script: (It does not seem to execute, but cron shows it ran.<br>
The backup script works fine via cron, but does not get executed when<br>
called from this script)<br>
<div class="im"><br>
#!/bin/bash<br>
<br>
HOST="windowshostname"<br>
<br>
CMD="ping -c1 $HOST"<br>
CMD_RET=`$CMD`<br>
# echo $CMD_RET<br>
NOWDATE=`date +%Y%m%d`<br>
<br>
if [ -f ping_check.txt ];<br>
then<br>
FILEDATE=`cat ping_check.txt`<br>
else<br>
FILEDATE=0<br>
fi<br>
<br>
if [ $NOWDATE -ne $FILEDATE ];<br>
then<br>
if [[ $CMD_RET =~ ", 0% packet loss" ]]<br>
then<br>
echo "$HOST pinged ..."<br>
echo $NOWDATE > ping_check.txt<br>
# run backup script<br>
else<br>
echo "$HOST did not ping ..."<br>
fi<br>
fi<br>
<br>
exit<br>
<br>
<br>
<br>
</div><div><div></div><div class="h5">On 01/04/2011 04:24 PM, Smith, Craig A wrote:<br>
> Raymond Norton wrote:<br>
><br>
><br>
>> I tried appending> /dev/null, but can't get it to run like it does from the command line.<br>
>><br>
><br>
> Does it send an annoying email every time it runs?<br>
><br>
> If so, try adding \;> /dev/null 2>&1<br>
> to the end of crontab entry.<br>
><br>
> For example:<br>
><br>
> 1-59/10 * * * * /path-to-script/scrip.sh \;> /dev/null 2>&1<br>
><br>
> will silently run the script every 10min.<br>
> _______________________________________________<br>
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
> <a href="mailto:tclug-list@mn-linux.org">tclug-list@mn-linux.org</a><br>
> <a href="http://mailman.mn-linux.org/mailman/listinfo/tclug-list" target="_blank">http://mailman.mn-linux.org/mailman/listinfo/tclug-list</a><br>
><br>
><br>
<br>
_______________________________________________<br>
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
<a href="mailto:tclug-list@mn-linux.org">tclug-list@mn-linux.org</a><br>
<a href="http://mailman.mn-linux.org/mailman/listinfo/tclug-list" target="_blank">http://mailman.mn-linux.org/mailman/listinfo/tclug-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div><font color="#888888"><div>“Twenty years from now you will be more
disappointed by the things that you didn’t do than by the ones you did
do. So throw off the bowlines. Sail away from the safe harbor. Catch the
trade winds in your sails. Explore. Dream. Discover.”</div>
<div>– Mark Twain</div></font></div><br>