linux 判断某个进程是否存在,存在则重启,不存在则启动。
2017-12-29 11:26
399 查看
++++++++++++++++++++++++++++++++++++ PIDS=`ps -ef|grep "app.js"|grep -v grep`
if [ "$PIDS" != "" ]; thenpm2 restart appecho "app restart!"elsepm2 start app.jsecho "app started"fi
+++++++++++++++++++++++++++++++++++
## 下面是node环境 webhook脚本配置
#!/bin/bash
export NODE_HOME=/usr/bin/nodeexport PATH=$NODE_HOME/bin:$PATHecho "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"cd /www/wwwroot/api/nodeApi/git reset --hard origin/mastergit clean -fgit pullPIDS=`ps -ef|grep "app.js"|grep -v grep`if [ "$PIDS" != "" ]; thenpm2 restart appecho "app restart!"elsepm2 start app.jsecho "app started"fipm2 show 0echo "----------------------------------------------------------------------------"
if [ "$PIDS" != "" ]; thenpm2 restart appecho "app restart!"elsepm2 start app.jsecho "app started"fi
+++++++++++++++++++++++++++++++++++
## 下面是node环境 webhook脚本配置
#!/bin/bash
export NODE_HOME=/usr/bin/nodeexport PATH=$NODE_HOME/bin:$PATHecho "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"cd /www/wwwroot/api/nodeApi/git reset --hard origin/mastergit clean -fgit pullPIDS=`ps -ef|grep "app.js"|grep -v grep`if [ "$PIDS" != "" ]; thenpm2 restart appecho "app restart!"elsepm2 start app.jsecho "app started"fipm2 show 0echo "----------------------------------------------------------------------------"
相关文章推荐
- Linux下父进程通过管道发送文件名给子进程,子进程获取文件名后首先判断文件是否存在,不存在,通过管道返回错误信息,存在,将文件内容返回给父进程
- linux查看进程是否存在,不存在则重启
- Linux判断进程是否存在并启动该进程
- LINUX判断进程是否存在并启动该进程
- linux监控某进程是否存在,不存在则启动
- Linux判断进程是否存在并启动该进程
- shell判断一个进程是否存在,如果不存在重启该进程
- Java文件夹操作,判断多级路径是否存在,不存在就创建(包括windows和linux下的路径字符分析),兼容Windows和Linux
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 定时检测Memcached进程是否存在,若不存在自动启动它
- Linux下判断进程是否存在的好方法
- c++判断文件夹是否存在,若不存在,调用linux命令创建它
- linux判断进程或者cron是否存在shell
- C#判断当前启动程序进程是否存在
- Python3判断shell下进程是否存在&&启动&&邮件通知
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例