Creating a systemd service

If the operating system you are using is recent, such as Debian 8 or Ubuntu 16.04, you should be using systemd for the init system.

To add a new service to the system, we just need to create a file describing it. Create a /lib/systemd/system/odoo.service file with the following content:

[Unit] 
Description=Odoo 
After=postgresql.service 
 
[Service] 
Type=simple 
User=odoo 
Group=odoo 
ExecStart=/home/odoo/odoo-11.0/odoo-bin -c /etc/odoo/odoo.conf 
 
[Install] 
WantedBy=multi-user.target 
The Odoo source code includes a sample odoo.service file inside the debian/ directory. Instead of creating a new file, you can copy it and then make the required changes. At least the ExecStart option should need to be changed, according to ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.