BYTECODES

Linux程序重启脚本

linux程序重启脚本,适用于没有很好重启办法的程序使用

#!/bin/sh 
pidlist=`ps -ef|grep myapp |grep -v "grep"|awk '{print $2}'` 
if [ "$pidlist" = "" ] 
then 
echo "no myapp pid alive!" 
else 
echo "killing pidlist :  $pidlist" 
kill -9 $pidlist 
echo "myapp stopped successfully!"  
sleep 1  
fi 
nohup myapp &
echo "done!"