-
1 Attachment(s)
help with scripting
I'm not sure what is buggy with this script. see attached
status)
TOMCAT_PID=$(pgrep -f "/usr/apache-tomcat-6.0.18/bin")
echo $TOMCAT_PID
if [-z $TOMCAT_PID] then
echo Apache Tomcat running with PID $TOMCAT_PID.
exit 1
else
echo Apache Tomcat is not running.
fi
;;
:confused:
Command line:
[root@desktop10 init.d]# ./tomcat status
./tomcat: line 29: syntax error near unexpected token `else'
./tomcat: line 29: ` else'
[root@desktop10 init.d]#
-
try putting a line break before then "then" that comes after [-z $TOMCAT_PID]
as in:
TOMCAT_PID=$(pgrep -f "/usr/apache-tomcat-6.0.18/bin")
echo $TOMCAT_PID
if [-z $TOMCAT_PID]
then
echo Apache Tomcat running with PID $TOMCAT_PID.
exit 1
else
echo Apache Tomcat is not running.
fi