<div dir="ltr"><div>Are you trying to run this as a Bash script with <i>#!/bin/bash</i> (or some from of Bash)? <br>or are you trying to run this as a Bourne shell with <i>#!/bin/sh</i> (or some form of Borne)?<br><br></div>
-> Jake<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 12, 2013 at 9:01 AM, Raymond Norton <span dir="ltr"><<a href="mailto:admin@lctn.org" target="_blank">admin@lctn.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I run the following script to test if a host is on-line and trigger a back up if it's alive. Something apparently changed with the script and it is giving me a "unary operator expected" error for line 17.<br>
<br>
Any ideas what is triggering it?<br>
<br>
<br>
<br>
if [ -f /etc/bacula/ping_check.txt ];<br>
then<br>
FILEDATE=`cat /etc/bacula/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 > /etc/bacula/ping_check.txt<br>
# run backup script<br>
/etc/bacula/backup-host-1<br>
<br>
else<br>
echo "$HOST did not ping ..."<br>
fi<br>
fi<br>
<br>
exit<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Raymond Norton<br>
LCTN<br>
<a href="tel:952.955.7766" value="+19529557766" target="_blank">952.955.7766</a><br>
<br>
Sent from My Desktop<br>
<br>
______________________________<u></u>_________________<br>
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
<a href="mailto:tclug-list@mn-linux.org" target="_blank">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/<u></u>mailman/listinfo/tclug-list</a><br>
</font></span></blockquote></div><br></div>