RSA Admin

error when running nicsftp.sh at McAfeeWebGateway7

Discussion created by RSA Admin Employee on May 23, 2012
Latest reply on Aug 21, 2012 by RSA Admin

Hi community,

 

Nicsftp.sh file was working with no problems when we first set it on our web gateway but after few weeks setting up the cron job to automate the process file is currently giving an error as below even if we try to start it manually:

 

[user@computer nic]# ./nicsftpagent.sh

expr: syntax error

./nicsftpagent.sh: line 412: [: -gt: unary operator expected

 

Any clues? 

 

***

Line 412 is as below marked with red by the way: 

 

#################################################
# If a copy of the script is running. exit now.#
#################################################
if [ -f "$NIC_DIRECTORY/running$ENVISION" ]
then
if [ "x$SILENT" = "x" ]
then
echo "A file exists indicating an instance of the script"
echo "is already running. If the script has not updated"
echo "this file in $KILL_RUNNING_AFTER seconds, this original"
echo "process will be stopped."
fi

RUNNING=`cat "$NIC_DIRECTORY/running$ENVISION" 2>/dev/null`
#WAITING=`date +%s`
#Bug 112031
WAITING=`perl -e 'print time(),"\n"'`
DIFF=`expr $WAITING - $RUNNING`

if [ $DIFF -gt $KILL_RUNNING_AFTER ]
then
if [ "x$SILENT" = "x" ]
then
echo "The previous script has not responded in $DIFF"
echo "seconds. If it is still running we will attempt to stop it."
fi

rm -f "$NIC_DIRECTORY/running$ENVISION"
# kill the pid now.
OLDPID=`cat "$NIC_DIRECTORY/running$ENVISION.pid" 2>/dev/null`

if [ `ps -aef | grep $OLDPID | grep $SCRIPT_NAME | wc -l | awk '{print $1}'` -gt 0 ]
then
if [ "x$SILENT" = "x" ]
then
echo "This script running on PID $OLDPID is inactive and being killed."
fi
kill -9 $OLDPID
fi
else
if [ "x$SILENT" = "x" ]
then
echo "The previous instance was active $DIFF seconds ago."
echo "This instance will exit now."
fi

exit 0;
fi
fi

TIMENAME=`date +%Y%m%d%H%M%S`

#################################################
# what are we going to do
################################################# 

Outcomes