See my other blog post here
As an example, we have a script /usr/bin/mydaemon which in this example will run forever.
#!/bin/sh
while true; do
date;
sleep 60;
done
We need to make it executable:
chmod +x /usr/bin/mydaemon
Create a unit /etc/systemd/system/mydaemon.service
[Unit]
Description=My daemon
[Service]
ExecStart=/usr/bin/mydaemon
Restart=on-failure
[Install]
WantedBy=multi-user.target
To start the deamon;
systemctl start mydaemon.service
To stop the deamon;
systemctl stop mydaemon.service
To enable it to start at boot time;
systemctl enable mydaemon.service
No comments:
Post a Comment
Note: only a member of this blog may post a comment.