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


原因:由于其他原因,或者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)

 

相关内容

    暂无相关文章