java程序启动脚本

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cpongo3/article/details/89327707

start(){
if [ -f start.pid ]
then
echo ‘File start.pid is already exist.’
else
rm -rf nohup.out
nohup java -server -jar test.jar &
echo $! >> ./start.pid
echo ‘Started Successfully.’
fi
}

stop(){
if [ -f start.pid ]
then
cat start.pid | while read line
do
kill $line
done
rm -rf start.pid
echo ‘Stopped Successfully.’
else
echo ‘File start.pid can not find.’
fi
}

case “$1” in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
printf ‘Usage: %s {start|stop|restart}\n’ “$prog”
exit 1
;;
esac

Categories: Java

发表评论 取消回复

placeholder.jpg

电子邮件地址不会被公开。

Name
Email
Website
What's on your mind?

猜你喜欢

转载自blog.csdn.net/cpongo3/article/details/89327707