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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With