tcptemplate/restart.sh

16 lines
248 B
Bash

#!/bin/bash
PID=$(ps -e|grep $1|awk '{printf $1}')
if [ $? -eq 0 ]; then
echo "process id:$PID"
else
echo "process $1 not exit"
exit
fi
kill -9 ${PID}
if [ $? -eq 0 ];then
echo "kill $1 success"
else
echo "kill $1 fail"
fi
$1 &