Systemd equivalent to rc.local?


I have a problem that would have been simple in the good old days of BSD Init or SystemV, but that looks a bit more complex with systemd. Here goes.

I have to run the following command at boot time, roughly after bluetooth.service has started and before SDDM is loading:

bluetoothctl connect 00:26:BB:7F:A3:07

Up until RHEL 6.x I simply would have put this command along with its arguments in /etc/rc.d/rc.local, and this would be the end of it.

What’s the orthodox way to do this with systemd ?

Albeit your concrete issue. Its still possible to use /etc/rc.d/rc.local to activate it: chmod +x /etc/rc.d/rc.local

1 Like

The question was how to do this in systemd. The closest you’ll get is a “oneshot” service unit in /etc/systemd/system or /usr/local/lib/systemd/system.


OK, so I experimented a bit, and here’s a crisp and clean solution for my problem:

You could add


into [Service]. Then the state would not go to “dead”.

1 Like

Unfortunately the mouse won’t connect with this variant.