wsl 创建服务 启动停止, init

////////////////////////////////////////////////     运行   //////////////////////////////////////////////////////////////////
#!/bin/bash
/opt/odoo16env/bin/python3 /opt/www/odoo16pro/odoo-bin -c /opt/www/odoo16pro/odoo.conf -i base
/opt/odoo17env/bin/python3 /opt/www/odoo17pro/odoo-bin -c /opt/www/odoo17pro/odoo.conf -i base

////////////////////////////////////////////////     ODOO16   //////////////////////////////////////////////////////////////////
sudo vim /etc/systemd/system/odoo16.service

Description=odoo16_service
After=basic.service
[Service]
Type=oneshot
KillMode=control-group
WorkingDirectory=/opt/www/odoo16pro/
ExecStart=/opt/odoo16env/bin/python3 /opt/www/odoo16pro/odoo-bin -c /opt/www/odoo16pro/odoo.conf -i base
[Install]
Alias=odoo16_service
WantedBy=multi-user.target


sudo chmod +x /etc/systemd/system/odoo16.service

systemctl daemon-reload
systemctl enable /etc/systemd/system/odoo16.service
//init下直接运行 sudo service odoo16.service start 即可

/////////////////////////////////////////////     ODOO17    /////////////////////////////////////////////////////////////////////
sudo vim /etc/systemd/system/odoo17.service

Description=odoo17_service
After=basic.service
[Service]
Type=oneshot
KillMode=control-group
WorkingDirectory=/opt/www/odoo17pro/
ExecStart=/opt/odoo17env/bin/python3 /opt/www/odoo17pro/odoo-bin -c /opt/www/odoo17pro/odoo.conf -i base
[Install]
Alias=odoo17_service
WantedBy=multi-user.target


sudo chmod +x /etc/systemd/system/odoo17.service

systemctl daemon-reload
systemctl enable /etc/systemd/system/odoo17.service
//init下直接运行 sudo service odoo17.service start 即可

  

posted @ 2023-11-29 10:17  CrossPython  阅读(121)  评论(0编辑  收藏  举报