odoo12 centos执行shell脚本监测服务状态崩溃重启

时间:2020-03-12 12:43:54   收藏:0   阅读:83

原因:由于其他原因,或者odoo内部服务自动停止掉,需要一个脚本来监测状态,自动启动。

步骤:

1、在任意目录下新建shell脚本odoodaemon.sh

 1 #!/bin/sh
 2 # ckconfig: 2345 20 81
 3 
 4 while true;
 5 do
 6 processExist=`ps aux | grep odoo12 | grep -v "grep"`
 7 if [ -z $processExist ];then
 8         echo "proecss is restarted"
 9         systemctl start odoo12  # 启动程序的脚本所在的绝对路径
10 else
11         echo "process is running"
12 fi
13         sleep 60 #每 60s检查一次
14 done

2、把脚本移动到/etc/rc.d/init.d/下

mv odoodaemon.sh /etc/rc.d/init.d/

3、给权限

chmod u+x odoodaemon.sh

4、加入到系统服务

chkconfig --add odoodaemon.sh 

5、启动

systemctl start odoodaemon

6、加入开启自动启动

chkconfig odoodaemon.sh on

7、查看

 chkconfig --list

技术分享图片

 

 查看odoo进程(ps -aux | grep odoo)

技术分享图片

 

原文:https://www.cnblogs.com/xiaozhuxing/p/12467977.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!