Results 1 to 2 of 2
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
...
- 09-21-2008 #1Just Joined!
- Join Date
- Nov 2007
- Posts
- 8
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
;;

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]#
- 09-22-2008 #2Just Joined!
- Join Date
- Feb 2007
- Location
- LA/Berkeley
- Posts
- 32
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


Reply With Quote