0    课程地址

https://coding.imooc.com/lesson/380.html#mid=28371

 

1    浓缩精华
1.1  浓缩精华

3.1,3.2

 

2    个人关注
2.1  个人关注

3.1,3.2

 

3    课程内容
3.1  startup.sh编写

 

nohup java -jar imooc-springboot-study.jar &

#   nohup命令:如果你正在运行一个进程,而且你觉得在退出帐户时该进程还不会结束,那么可以使用nohup命令。该命令可以在你退出帐户/关闭终端之后继续运行相应的进程。
#   & 放在启动参数后面表示设置此进程为后台进程

 

 

3.2  stop.sh编写
pid='ps -ef | grep imooc-springboot-study.jar | grep -v grep | awk '{print $2}''
if[[ -z "${pid}"]]
then
    echo application is already stoped
else
    echo kill ${pid}
    kill -9 ${pid}
fi


#ps -ef 查询到所有进程
#grep imooc-springboot-study.jar  找到对应的进程
#grep -v grep   找到启动命令的进程
#awk '{print $2}'   获取对应的进程的id
#'{print $2}' 打印第二个参数

 

 

 

4    代码演练

 

posted on 2021-01-19 07:16  菜鸟乙  阅读(92)  评论(0编辑  收藏  举报