linux下服务器重启shell脚本


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]$ 

猜你喜欢

转载自wuzhaohuixy-qq-com.iteye.com/blog/2165892