smellsofbikes: (Default)
[personal profile] smellsofbikes
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:

[Unit]
Description=blinker
ConditionPathExists=|/home/debian/programming/python

[Service]
ExecStart=/home/debian/programming/python/blinker.py
SyslogIdentifier=blinker
Restart=always

[Install]
WantedBy=multi-user.target

Then go to /etc/systemd/system/multi-user.target.wants and make a symlink to that file.

ln -s /lib/systemd/system/blinker.service /etc/systemd/system/multi-user.target.wants/blinker.service

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:
ConditionPathExists=|/home/debian/programming/python
After=network.target

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.

Profile

smellsofbikes: (Default)
smellsofbikes

March 2015

S M T W T F S
1234567
891011 121314
15161718192021
22232425262728
293031    

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 25th, 2017 07:49 pm
Powered by Dreamwidth Studios