I am able to run a Python3 script at system startup on my SBC4. I added the following line in the /etc/rc.local file, right before the exit(0) line at the end:
(sleep 60 ; echo $(date) >> lastboot; /usr/bin/python3 /root/testBoot. py)&
Without going into a nauseous amount of detail, this line (consisting of 3 commands) does run correctly. It sleeps for 60 seconds to make sure the system completes the boot process, adds the current timedate stamp to a file called lastboot, then runs the Python3 script "testBoot. py". "testBoot. py" does two small tasks: it prints an output to the screen and prints an output to a file; this way, I can make sure the python script is running by the presence of the file it created.
My problem is not being able to get any of the output from my Python script to go to the console. I have tried several different methods of sending output from the script, but none have worked.
import sys, sys.stdout.write("Hello")
import os, os.system("echo test")
import os, os.system("echo 123456 > /dev/tty")
I'm not a total noob, but I am only a novice with regards to standard outputs on linux.
However, the above method (Python3 script in rc.local) prints to the console correctly on a Raspberry Pi.
I know the Phidget Web GUI will let me run a script on startup, but that stdout is redirected to the web page view, and I need to see output on the terminal.
Any help is greatly appreciated.