12345678910111213141516171819202122232425 |
- #!/bin/bash
- # 进程名
- process="timesheet"
- # 获取进程ID
- PID=$(ps -ef | grep $process | grep -v grep | awk '{print $2}')
- if [ -n "$PID" ]; then
- echo "$process is exist"
- if ps -p $PID >/dev/null; then
- echo "$process is runnig"
- else
- echo " $ process is not running"
- fi
- else
- echo "$process is not exist"
- fi
- echo $PID;
- # 暂停1秒
- sleep 1;
- kill -9 $PID;
- echo "$process is killed"
- ./startWorkTime.sh
- echo "restart timesheet success"
|