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.
From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

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. 27th, 2017 12:28 pm
Powered by Dreamwidth Studios