Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angstrom start-up processes [beaglebone]

I have a RFID module attached to my beaglebone and reading ID tags with a python code. Now, I want my python code to start running in the background directly when I login to my beaglebone without any commands . Just like adding a program to start-up programs in windows. When you login to your windows account, those programs start instantly. Do you have an idea how this can be done?

Regards

like image 267
Amadeus Bachmann Avatar asked Jun 22 '12 08:06

Amadeus Bachmann


1 Answers

Create a new file in /lib/systemd/system/ (rfidreader.service in my example) with content like:

[Unit]
Description=Start Python RFID reader

[Service]
WorkingDirectory=/...Python script path.../
ExecStart=/usr/bin/python rfidreader.py
KillMode=process

[Install]
WantedBy=multi-user.target

Then execute the following command to install the service:

systemctl enable rfidreader.service

To start the service, you can either reboot or execute:

systemctl start rfidreader.service

To check if the service is running and get the latest outputs from the script:

systemctl status rfidreader.service
like image 146
MathieuLescure Avatar answered Sep 27 '22 19:09

MathieuLescure