一共兩個(gè)shell文件,shutdown-force.sh和restart.sh霎奢。均可單獨(dú)使用蠕蚜,放到tomcat的bin目錄下即可,要賦予777權(quán)限
shutdown-force.sh
path=$(cd "$(dirname "$0")"; pwd)
ps -ef|grep $path|grep java|awk '{print $2}'
echo "exec $path/shutdown.sh"
$path/shutdown.sh
sleep 3s
#kill -9 pid
ps -ef|grep $path|grep java|awk '{print $2}'|xargs kill -9
#success msg
echo "shutdown success"
ps -ef|grep $path|grep java|awk '{print $2}'
restart.sh
set fileformat=unix
#!/bin/bash
path=$(cd "$(dirname "$0")"; pwd)
echo "exec $path/shutdown-force.sh"
$path/shutdown-force.sh
sleep 3s
$path/startup.sh
echo "restart success"