123456789101112131415161718192021222324 |
- #!/bin/bash
- appname=smqdBackup
- is_exist(){
- pid=`ps -ef|grep $appname|grep -v grep|awk '{print $2}' `
- #如果不存在返回1,存在返回0
- if [ -z "${pid}" ]; then
- return 1
- else
- return 0
- fi
- }
- is_exist
- if [ $? -eq "0" ]; then
- echo ">>> PID = $pid begin kill -9 $pid <<<"
- kill -9 $pid
- sleep 2
- echo ">>> $appname process stopped <<<"
- else
- echo ">>> $appname is not running <<<"
- fi
|