Browse - Programming Tips - How do I make a systemd service?

Date: 2013nov27
OS: Linux

Q.  How do I make a systemd service?

A.  This worked for me.  It might not be the perfect way.

1.  Make a script that starts your sevice.
Call it /usr/local/bin/MYSERVICE_start

2.  Make a so-called unit file in /lib/systemd/system/MYSERVICE.service
Put this stuff in it:

[Unit] Description=Description of My Service [Service] ExecStart=/usr/local/bin/MYSERVICE_start Type=simple [Install]
3. Make symbolic link
cd /etc/systemd/system ln -s /lib/systemd/system/MYSERVICE.service MYSERVICE.service
4. Make systemd take notice of it
systemctl daemon-reload
5. Activate the service immediately
systemctl start MYSERVICE
6. Enable the service to be started on bootup
systemctl enable MYSERVICE