Making the new daemon a systemd service
Now that we've made a new-style daemon in the previous recipe, we'll see that it's even easier to make a unit file for this daemon.
Knowing how to write unit files to new-style daemons is important since more and more daemons are written this way. When making new daemons for Linux, we should make them in this new style.
Getting ready
For this recipe, you'll need to complete the previous one. It's the daemon from that recipe that we'll use here.
How to do it...
Here, we will make the new-style daemon a systemd service:
- Let's begin by moving the daemon to
/usr/local/sbin
, just as we did with the traditional daemon. Remember, you'll need to be root for this:$> sudo mv new-style-daemon /usr/local/sbin/
- Now we'll write the new unit file. Create the
/etc/systemd/system/new-style-daemon.service
file and give it the following content. Remember, you'll need to be root to create...