0

So I have a python script that is using the raspberry pi serial RX,TX to communicate with a 4D System Display. It is working just as I want it to work, BUT, when I modify the /etc/rc.local to let this script run automatically at startup, and apply a reboot, the screen which uses the serial interface is not working. Knowing that all other tasks are working correctly, just the serial interface didn't work. So the problem might be that my script is running before serial interface is booting completely. so is there any workaround for such situation?

1

I found the solution just in case someone else faced the same issue, the solution is to use crontab instead of rc.local file:

sudo crontab -e

Scroll to the buttom and add this line:

@reboot python /home/pi/MyScript.py &
0

In the Python file, import time and add a time.sleep(seconds) in the beginning of the code. Also in the /etc/rc.local file, add a "&" sign together with the line starting the python script.

This will allow the pi to boot completely while still starting the python file automatically, this should work :)

  • I already tried that, but it didn't worked... but I got the solution which is using crontab instead of rc.local file, just like this: sudo crontab -e, and adding @reboot python /home/pi/MyScript.py & to the end of the file – Dani Aug 10 '16 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.