Systemd is a system manager and the new Linux init system. This guide shows how to start a Python application with the
Create a systemd service file
As the root user, create an
application.service file in the
/etc/systemd/system directory. You can name the application in whatever you want.
$ vi /etc/systemd/system/application.service
Write the following content into the file:
[Unit] Description=Python Service Script After=network.target [Service] Type=idle ExecStart=/usr/local/bin/applicaton.py [Install] WantedBy=multi-user.target
Enable and start the application as a service
After saving the file, reload the systemd daemon so that it knows about the new service.
$ systemctl daemon-reload $ systemctl enable application.service
Start the Application service by typing
$ systemctl start application.service
$ systemctl start application
Show the status, if the service is started
$ systemctl status application
Now the service should start by each start of the system.