Home Store Blog

How to start a program at boot with sudo/root


#1

Normally, the command is executed from an /etc/rc.local file, if my memory serves. Such a file doesn’t exist. Can I create the file and put the command in it?


#2

Think systemd is the way to go here. This Q&A will help


#3

Thanks. I’m completely unfamiliar with this method, so I’ll be reading your link carefully.

For reference’s sake, I’m using TwonkyServer as a media server.


#4

I finally got around to trying this. It works, but I have to look for a different solution. The media to be shared is on a drive attached to the router. The service starts before the network connection is made, so Twonky starts with an empty database. At least, that’s my guess as to what is happening. If I start Twonky manually, after everything else has happened, it simply verifies an already filled database.


#5

You probably just need to add some network requirement to your .service file, e.g.

[Unit]
After=network.target
After=network.online.target

I agree that systemd is somewhat mystifying, but it seems to be here to stay.


#6

Yeah, I saw that as I did further reading into this. I’ll try it again at another time; for the time being, it isn’t that much of an effort to start the service myself once I note that the network share mounted.

Thanks!