#!/bin/bash
ID=`ps -ef | grep "abc" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
echo $ID
echo "---------------"
for id in $ID
do
kill -9 $id
echo "killed $id"
done
echo "---------------"
nohup java -jar /home/abc.jar >/home/log.out &
nohup cat /home/log.out |cronolog /home/logs/log_%Y%m%d.log 2>&1 &
转载于:https://my.oschina.net/u/3138954/blog/1855010