Linux : Create systemd service for python app
2019, November, 29
LinuxSystemdCodeHow-To
- Create file service-name.service in /etc/systemd/system.
[Unit]
Description=Service Name
After=multi-user.target
[Service]
Type=simple
Restart=always
User=ubuntu
ExecStart=/usr/bin/python3 /path/to/app.py
[Install]
WantedBy=multi-user.target
- Enable service start on reboot:
sudo systemctl enable service-name.service
- Start service
sudo systemctl start service-name.service
- Check service status
systemctl status service-name.service