In general, services are located in /etc/systemd/system/
and are described in .services
files.
To create a new service, follow the steps:
Create a .service
file, for example my-app.service
Add context:
[service]
ExecStart=/usr/bin/python3 /opt/code/app.py
Reload systemctl daemon: $ systemctl daemon-reload
Start the new service: $ systemctl start my-app
To start a service when the system is booted up:
[unit]
Description=My python web app
[service]
ExecStart=<command>
ExecStartPre=<command>
ExecStartPos=<command>
[install]
WantedBy=multi-user.target
TODO