i use this .sh file and code entered in /etc/rc.local so that it starts up when the pi does but i want to know if its possible to force it to use Python3 for this script
Code: Select all
#!/bin/sh
until /home/pi/usb-scanner/usb_scanner.py; do
date_time=$(date +"%Y-%m-%d %H:%M:%S")
echo "$date_time\t[Script]\tScript crashed with exit code $?. respawning...\n" | tee /dev/tty >> errors.log
sleep 1
done
Code: Select all
sleep 1
/home/pi/usb-scanner/usb_scanner.sh&
could i do something like this
in my .sh file ...
Code: Select all
#!/bin/sh
until sudo python3 /home/pi/usb-scanner/usb_scanner.py; do
date_time=$(date +"%Y-%m-%d %H:%M:%S")
echo "$date_time\t[Script]\tScript crashed with exit code $?. respawning...\n" | tee /dev/tty >> errors.log
sleep 1
done
I use the .sh file to log an error if the Script wont start,
Should i just scrap the .sh file and run
in /etc/rc.local
Code: Select all
(sleep 10;python3 /home/pi/usb-scanner/usb-scanner.py)&