Adding service at boot

Hi all,

I would like to start a program at startup and was looking at creating a new systemd service.
This is the first time I would be using systemd, and it does seem to me that the order of services at boot could matter, based on what the service in question is doing.
What I have in mind is independent from the main use of Rockstor and thus doesn’t rely on having any specific volume mounted, for instance. I was therefore thinking of setting this service to boot last, after all the services critical to Rockstor.
This is where my question lies: what would be the recommended setting for the “After=” part of a new systemd file on a Rockstor system? In other word, what would be the last service to be loaded by default?

Thanks for your help,

@Flox A slightly belated Welcome to the Rockstor community to you by the way. To get a picture, literally, of the current order of systemd units you can execute the following command:

systemd-analyze plot > boot.svg

This will generate an svg image of the boot process which you can retrieve from the directory in which you executed that command, in my case it was root’s default of /root so on a client machine I retrieved the file from the rockstor machine to the client current working directory via:

scp root@rockstor-machine-ip://root/boot.svg .

Don’t forget the ‘.’ at the end to signify the current directory (on a linux client in this case).
Then you can view the boot process pictorially which is nice.

Here is an example from a kvm hosted rockstor development machine’s boot that I converted to jpg to allow posting.

Hope this helps to clarify things.

1 Like

To @phillxnet - Opening an OT in this topic, after reading your latest reply: do you remember about adding systemd infos over logs manager? Ok, i thought about systemd-analyze funcs directly into services page or similar.

End OT :slight_smile:


That is exactly what I needed and even more informative… I didn’t know about this feature of systemctl.
Thanks a lot for the help!

@Flox Your welcome. Let us know how you get on with your custom systemd script.

1 Like