查询并删除进程

#!/bin/bash

now=`date "+%Y-%m-%d %H:%M:%S"`

#kill -9 `ps -ef | grep transfer.jar | grep -v "grep" | awk '{print $2}'`

pids=`ps -ef|grep -w transfer.jar | grep -v "grep" | awk '{print $2}'`

if test -z $pids
then
echo ${now} 'transfer Error' >> /home/sir/logs/test.log
else
echo ${now} 'transfer OK' >> /home/sir/logs/test.log
fi

 

posted @ 2018-06-05 14:45  诚信天下  阅读(245)  评论(0编辑  收藏  举报