linux下サーバshellスクリプトの再起動
1469 ワード
drwxr-xr-x. 4 richmail richmail 4096 12 8 15:17 admin
drwxr-xr-x. 5 richmail richmail 4096 12 11 09:56 help
-rw-rw-r--. 1 richmail richmail 46398327 12 11 11:25 help.zip
drwxr-xr-x. 4 richmail richmail 4096 12 10 17:39 mail
-rwxr-xr-x. 1 richmail richmail 500 12 5 17:56 restartTomcat.sh
-rw-r--r--. 1 richmail richmail 51784276 12 10 17:40 ThinkMail_webmail(V2.0.0)_201412101739.zip
drwxr-xr-x. 9 richmail richmail 4096 11 17 18:17 tomcat7
-rw-rw-r--. 1 richmail richmail 0 10 22 13:12 x
[richmail@datanode1 webmailsvr]$ cat restartTomcat.sh
#Author : dengliang
#Desc : restart tomcat
#Time : 2014-12-05
tomcatpath="/home/richmail/web/webmailsvr/tomcat7"
#!/bin/sh
#kill tomcat pid
pidlist=`ps -ef|grep $tomcatpath |grep -v "grep"|awk '{print $2}'`
if [ "$pidlist" = "" ]
then
echo "no tomcat pid alive!"
else
echo "tomcat pid list : $pidlist"
echo "killing pidlist : $pidlist"
kill -9 $pidlist
echo "tomcat stopped successfully!"
sleep 1
fi
echo "now starting tomcat......"
cd $tomcatpath/bin
./startup.sh
cd -
[richmail@datanode1 webmailsvr]$
[richmail@datanode1 webmailsvr]$