I have a Ubuntu 16.04 machine. I have written a very simple systemd service.
The purpose of this is to create a service that will start once the booting process is done and run a python script. It should also restart the python script if the python script crashes.
This is how my systemd script looks like.
[Unit]
Description=My Python Script
Requires=multi-user.target
After=multi-user.target
[Service]
Type = forking
WorkingDirectory=/path/to/my/python/script/
ExecStart=/usr/bin/python /path/to/my/python/script/mypythonscript.py
Restart=always
[Install]
WantedBy=multi-user.target
This script has been written using this tutorial. I followed the steps there just changed names.
I now have a service that I can stat manually. If I do sudo service myservice start
I am able to start my service. However, the service does not start when the machine boots. It needs to be started manually.
Do you know how I can fix that?
What is the correct way to have a service start after the machine boots, on a Ubuntu 16.04 OS?
Thanks!