add a +x to the first line "#!/bin/bash -x" and run the script.

On Tue, Jan 4, 2011 at 6:40 PM, Raymond Norton <admin at lctn.org> wrote:

> 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
> >
> >
>
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>



-- 
“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.”
– Mark Twain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20110104/573aeefd/attachment.htm