tomcatの起動シェルを作っているのですが、止まった状態でservice tomcat startといれてもtomcat is already runningの一点張りで起動してくれません。
また、起動している状態でservice tomcat stopと入れても、
NGとでます。
どこを直せばよいでしょうか?
cat /etc/rc.d/init.d/tomcat
#!/bin/bash
tomcat Startup script for the Apache Tomcat
description: Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies.
Source function library.
. /etc/rc.d/init.d/functions
prog='tomcat'
user='usa'
exec='/usr/ss/tomcat/bin'
GREP='ps aux | grep tomcat | grep -v grep | wc -l'
start() {
if [ "$GREP" = 0 ]; then
su - $user -c "$exec/startup.sh"
sleep 5
if [ "$GREP" = 0 ]; then
echo "NG"
else
echo "OK"
fi
else
echo "$prog is already running "
fi
}
stop() {
if [ "$GREP" = 0 ]; then
echo "$prog is already stopping."
else
su - $user -c "$exec/shutdown.sh"
sleep 5
if [ "$GREP" = 0 ]; then
echo "OK"
else
echo "NG"
fi
fi
}
See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $"Usage: $prog {start|stop|restart}"
exit 2
esac
exit
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/11/20 09:58
退会済みユーザー
2015/11/20 09:58
2015/11/20 10:00
2015/11/20 12:36