I have a python script which extracts continuous data from an incoming serial string and inserts the fields into an Sql database.
The python script can be run manually from an LX terminal and works successfully whilst the terminal remains open. This is easily tested by examining an associated web site where a PHP script is used to extract the data from the data base and display it in a HTML page.
I have tried a number of techniques to have the Python script executed automatically on restart. The closest I have got is for the terminal to open momentarily, start to run the python script and then close. I have tried delaying the opening on the terminal for a number of seconds to ensure there is no clash with the desktop or other applications starting, without luck.
The techniques that have been tried include:
- Creating a .desktop file in ~/.config/autostart to start the python script in an LX terminal. I have also tried delaying the start of the .desktop file via an .sh script with a 10 sec delay (sleep 10).
- Starting the Python script using the @reboot command in a cron job.
- Using Upstart with a .config file in /etc/init.
- Modifying the /etc/rc.local file to run the Python script.
I don't believe this is a permissions issue as the /usr/bin/python ~/user/file.py command and .desktop file can be run manually OK.
Any help will be greatly appreciated.
The environment is an UDOO Quad SBC running Ubuntu on the ARM processor, with the embedded Arduino Due capturing sensor data and transferring the string of data to the ARM processor.