查询并删除进程
#!/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