Originally written in 2017. I said, “It seems systemd can’t be avoided. I am annoyed at having to relearn stuff for a problem not worth solving”. I had another look in 2025, added some links as this time I wanted to move some job commands from cron to systemd i.e. run the programs/scripts periodically. Here are my notes as I learn to use it.

Originally, I made two service definition files, and posted them to this git folder, for deluge, and no2ip’s DNS Update Client. These are both daemons. In my github folder, there is also a script for enabling sysstat which references timers. I had to write a service file for no-ip’s dynamic update client. I remain confused about the choice of the type argument, but the link from red hat below is very clear & helpful.

So in looking to define services that ran periodically and ended, research and the links below, pointed me at .timer files. There are now separate scheduler files, which maybe an answer to the crontab permission problems I am having.

In the end, I cheated, I asked google gemini to write for me,

  1. Systemd service for daemon script
  2. Systemd service for scheduled script

You’ve got to laugh. As I worked though some of the documents below, I discovered that Raspbian now distributed a service definition for apt and updatedb, which is/was the problem I was looking to solve.

Links, found in 2025

I had another look in 2025, and in this case I was looking to run a script, not a daemon. I found these:

  1. On Systemd
  2. Systemd Type argument
  3. Systemctl
    • A tutorial on the commands from digital ocean, concentrates on the systemctl commands and parameters. It documents the is-active and is-failed arguments, which might be good to incorporate into my check_service script.
    • I found this at devdungeon.com; it has another example service file, with a dummy daemon, and a good summary of the necessary systemctl commands.
  4. Timer files

2017 and an example from me

Some links from my original research …

  1. About starting and stopping, from stack_exchange, and the importance of type=, it has a good write up of this, and I must have found it very useful. It is dated 2016
  2. Type= simple or forking, from Red Hat, at superuser.com, and oneshot, made in 2018, another very comprehensive writeup of the Type argument.

An example,

[Unit]
Description=A description of the service
After=network.target

[Service]
Type=simple # check link No 1 & 2 above
User=root
ExecStart=${program_path}/${program_name}
# explicit absolute path reqd

[Install]
WantedBy=multi-user.target
Dave Linux, Technology , ,

4 Replies

  1. It may be much more economic in terms of lines of code, although it may just shift logic from the integrated object based lsb init scripts to new start & stop scripts; it should be noted that using scripts other than the service daemon to manage these complicates the work of systemd; it cannot use tupe=simple. (Edited 27/3/2019).

  2. I think there’s a problem with using virtual box file types with systemd; it ought to be possible to define mounts within a service file but this is not the case with virtualbox files. (I think I am still trying to use rc.mymounts to inboke these calls.

  3. I made my first file today, a service definition for noip’s dynamic update client and I have amended the article to more accuratley document or point at documents on type = simple vs forking.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.