#!/bin/bash
#tomcat start script
# ./tomcat_start.sh start|restart|stop
RETVAL=
0start() {
echo -n
"Tomcat Starting" echo
/root/java/apache-tomcat-
7.0.
47/bin/startup.sh
}
stop() {
echo -n
"Tomcat Stop" echo
" port "$
1 if [ !
"$1" ];then
echo
"Usage port " exit 1 fi
pid=`netstat -tpln|
grep $
1 | awk
'{print $7}' | awk -F/
'{print $1}'`
if [ -n
"$pid" ];then
echo
$pid echo
"kill -9 pid "$pid kill -
9 $pid fi
}
restart() {
echo -n
"Tomcat restart" echo
stop $
1 start
}
case
"$1" in
start)
start;;
stop)
stop
"$2";;
restart)
restart
"$2";;
*)
echo $
"Usage: $0 {start|stop|restart}" exit 1esac
exit $RETVAL