Search code examples
startupbeagleboardangstrom-linux

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


Solution

  • 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