You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riskshell/shell/killNode

24 lines
387 B

4 years ago
#!/bin/sh
4 years ago
#杀死进程
4 years ago
result=1
4 years ago
if [ -e run.pid ]
4 years ago
then
4 years ago
p=`cat run.pid`
4 years ago
kill -9 $p
4 years ago
if [ $? -eq 0 ]
then
4 years ago
echo "成功杀死进程:$p"
4 years ago
rm -f run.pid
4 years ago
else
4 years ago
echo "无法杀死进程:$p,重启$1失败"
4 years ago
result=0
4 years ago
fi
fi
4 years ago
if [ $result -eq 1 ]
then
4 years ago
echo "执行$1的运行脚本`pwd`/run.sh"
4 years ago
./run.sh
4 years ago
echo "执行$1的运行脚本`pwd`/run.sh,exit code:$?"
4 years ago
fi