systemd
is a system management daemon that replaces init.d
and is available on most distributions.Fedora documentation can be found here.
To create a new service, create a new configuration file
/etc/systemd/system/foo.service
(note that absolute path names are required, even for interpreters etc.):
[Unit]
Description=My service
Requires=network.target mysql.service
[Service]
Type=simple
ExecStart=/usr/bin/java -Dapp.properties=/home/pi/clock.properties -jar /home/pi/clock-1.1.jar
[Install]
WantedBy=multi-user.target
To start:
sudo systemctl start foo
To enable on startup:
sudo systemctl enable foo
To check if enabled
sudo systemctl is-enabled foo