回忆下以前写的脚本
[root@localhost jars]# vim test.sh
#!/bin/sh app=$2 echo "application is:$app" case "$1" in start) nohup java -jar /root/jars/$app".jar" > /dev/null & echo "start.ok" ;; restart) echo "restart..." echo "restart.ok" ;; stop) ps -ef | grep $app|grep -v grep|awk '{print $2}'|xargs kill -9 echo "stop.ok" ;; *) echo "commad illegality";; esac |
启动命令:
[root@localhost jars]# ./test.sh stop registry-web-starter