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

April 2017

S M T W T F S
      1
2 345678
9101112131415
16171819202122
23242526272829
30      

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 26th, 2017 10:18 am
Powered by Dreamwidth Studios