smellsofbikes: (Default)
smellsofbikes ([personal profile] smellsofbikes) wrote2015-03-12 11:03 pm

notes on beaglebone 2: systemd

You want a program to start running every time the beaglebone boots.
Use systemd because it's there and it actually works okay.

In /lib/systemd/system/ make a file (programname).service
So for this example, blinker.service

It should look like this:




Then go to /etc/systemd/system/ and make a symlink to that file.

ln -s /lib/systemd/system/blinker.service /etc/systemd/system/

The file itself, if it's python, must begin with #!/usr/bin/python (or wherever you have python installed) and be executable.

Then, systemctl --system daemon-reload
and systemctl start blinker.service

and your program should start immediately and also start every time you boot the beaglebone.

If your program is dependent on other services before it starts, you can add those under the [unit] group, like:

That way it will wait until the network is up before running -- which, in the case of what I'm building, is nice, because it's streaming internet radio.