linux启动程序和关闭程序脚本

关闭脚本:

#!/bin/bash
source /etc/profile
log()
{
echo `date +【%Y-%m-%d" "%H:%M:%S】` $1
}
log "kill 168 begain"
NAME=importFile168
echo $NAME
ID=`ps -ef | grep "$NAME" | grep -v "grep" | awk '{print $2}'`
echo $ID
echo "---------------"
for id in $ID
do
kill -9 $id
echo "killed $id"
done
log "kill 168 end"

 

启动脚本:

#!/bin/bash
source /etc/profile
log()
{
echo `date +【%Y-%m-%d" "%H:%M:%S】` $1
}
log "start 168 begain"
nohup /home/data/168/program/jdk1.8.0_111/bin/java -Drun.type=loaddata -ms512m -mx1024m -jar /home/data/168/program/importFile168.jar >> /home/data/168/program/168.log 2>&1 &
log "start 168 end"

  

posted @ 2018-12-27 18:29  Lost blog  阅读(1852)  评论(0编辑  收藏  举报