create file /lib/systemd/system/odoo-server.service
change ownership
[Unit]
Description=Odoo Open Source ERP and CRM
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
PermissionsStartOnly=true
SyslogIdentifier=odoo-server
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-10.0/odoo-bin --config=/etc/odoo.conf --addons-path=/opt/odoo/odoo-10.0/addons/
WorkingDirectory=/opt/odoo/odoo-10.0/
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
change ownership
sudo chmod 755 /lib/systemd/system/odoo-server.service sudo chown root: /lib/systemd/system/odoo-server.service
sudo chown -R odoo: /opt/odoo/
sudo chown odoo:root /var/log/odoo
sudo chown odoo: /etc/odoo.conf sudo chmod 640 /etc/odoo.conf
enable the service
sudo systemctl enable odoo-server
start the service
sudo systemctl start odoo-server
taken from :
https://www.linode.com/docs/websites/cms/install-odoo-10-on-ubuntu-16-04#create-an-odoo-service
NOTE :
if you change odoo-server.service, you need to run
sudo systemctl daemon-reload