Wednesday, 18 May 2016

Running a looping python script automatically

To run a looping python script at startup after a reboot or halt. The best way is to put the script in the root crontab.

Write the following command  : sudo crontab -e 
Enter the follwing line @reboot python3 /usr/python/arduino.py &
My personal choise of editor is nano so you might select nano in the editor chooser window. ctrl + x + x saves and exit.



NB! the & at the end. and then you can reboot your linux boot to test that everything is working fine. Youy can read more about crontab here : http://www.computerhope.com/unix/ucrontab.htm

No comments:

Post a Comment