Cannot run a python script on powerup

848 views
Skip to first unread message

mike rankin

unread,
May 13, 2014, 7:21:09 AM5/13/14
to beagl...@googlegroups.com
I found a great post over at: http://stackoverflow.com/questions/11152657/angstrom-start-up-processes-beaglebone on how to have a python script run on power up. 

My python code that displays text on an oled screen runs fine on Angstrom when I run it manually.

The web page says to:

Create a new file in /lib/systemd/system/ (rfidreader.service in my example) with a 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 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


My code:
[Unit]
Description=Start Python Oled

[Service]
WorkingDirectory=/home/root/py-gaugette/samples/
ExecStart=/home/root/py-gaugette/samples/python new_test.py
KillMode=process

[Install]
WantedBy=multi-user.target


My error message:
root@beaglebone:~# systemctl status oled.service
oled.service - Start Python Oled
  Loaded: loaded (/lib/systemd/system/oled.service; enabled)
  Active:
 failed (Result: exit-code) since Tue 2014-05-13 00:12:38 GMT+3; 23s ago
Process: 666 ExecStart=/home/root/py-gaugette/samples/python new_test.py
 (code=exited, status=203/EXEC)
  CGroup: name=systemd:/system/oled.service

May 13 00:12:38 beaglebone systemd[1]: Starting Start Python Oled...
May 13 00:12:38 beaglebone systemd[1]: Started Start Python Oled.
May 13 00:12:38 beaglebone systemd[1]: oled.service: main process exited, code=exited, status=203/EXEC
May 13 00:12:38 beaglebone systemd[1]: Unit oled.service entered failed state



Chriskner

unread,
May 13, 2014, 2:46:06 PM5/13/14
to beagl...@googlegroups.com
Nobody else has chimed in - and nearly anyone would be more qualified...

Could it be that you didn't properly specify 'python' in the "execstart" section of  [Service]?

This:
ExecStart=/home/root/py-gaugette/samples/python new_test.py

Should be this:

ExecStart=/usr/bin/python new_test.py
-Chris

mike rankin

unread,
May 14, 2014, 8:01:05 AM5/14/14
to beagl...@googlegroups.com
I made the change and it now works perfectly!

Thank you,
Mike
Reply all
Reply to author
Forward
0 new messages