Systemd

Systemd: Example service script

Example service script:
e.g. daphne application server with a django app.

# vi /etc/systemd/system/daphne.service
[Unit]
Description=daphne service to run django application
After=network.target
After=nginx.service

[Service]
Type=simple
User=mik
Group=mik
WorkingDirectory=/opt/app/
ExecStart=/opt/app/wine-env/bin/daphne djangoapp.asgi:application
ExecStop=/bin/kill -s TERM $MAINPID
Restart=always

[Install]
WantedBy=multi-user.target

Systemd

Helps for system administration with systemd:

Control and manipulate services

systemctl
systemctl enable [servicename]
systemctl stop/start [servicename]
systemctl disable [servicename]

Remove services from systemd

systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
systemctl daemon-reload
systemctl reset-failed