Systemd
Systemd is used to manage automatic services (eg services that should be run on startup and/or restarted when they fail)
Controlling Services
systemctl
is used to manage turning services on/off:
sudo systemctl start <service name>
sudo systemctl status <service name>
Defining Services
Create a file: /etc/systemd/system/<service name>.service
With the contents:
[Unit]
Description=your description
[Service]
ExecStart=/path/to/command/or/script
[Install]
WantedBy=multi-user.target
By default, the service will run as root. To run as a user, add the following under the [Service]
section:
User=<username>
Group=<groupname>
Note: to check the group of a user, use
$ id <username>
Notes mentioning this note
Systemd
Systemd is used to manage automatic services (eg services that should be run on startup and/or restarted when they fail)...