rc.local not working
so i'm trying to do 2 things with my omega on boot, set gpio mux and then run a python script that is to run for the lifetime of the device.
my rc.local script contains the following:
# the system init finished. By default this file does nothing. # setup the gpio mux sh /root/setup.sh >> /tmp/setup.log 2>&1 # run the main program python /root/Flash.py >> /tmp/flash.log 2>&1 & exit 0
the setup script is
omega2-ctrl gpiomux set i2c gpio omega2-ctrl gpiomux set i2s gpio
and the python script is:
import onionGpio import time import subprocess import os import sys gpio5 = onionGpio.OnionGpio(5) gpio5.setInputDirection() print 'Ready' while 1==1: #print 'GPIO5 set to: %s'%(value) if int(gpio5.getValue()) == 0: print 'starting flash' os.system("gpioctl dirout-low 4") os.system("sh /usr/UserFolder/ShellScript.sh") os.system("gpioctl dirout-high 4") print 'finish flashing' # time.sleep(5) else: time.sleep(.05)
these 2 scripts are not running. I can verify this by getting the gpio mux after boot and see that they are still the default, not my changes. They have been granted execute permissions and work flawlessly when ran individually from the shell. What am i missing?
Is there any possible permission issues with the log files?
What happens if you remove the logging output and just run the scripts?
What happens if you remove setup.sh and place the two gpiomux commands directly in rc.local?
Fabian Nydegger 0
> # run the main program > python /root/Flash.py >> /tmp/flash.log 2>&1 &
remove the second <&> you don't need it
python /root/Flash.py >> /tmp/flash.log 2>&1
Anyway you will have a problem logging files for a life time in /tmp. If you don't reboot your omega with cron every X days. The device will just stop working after a while, no space left...
You know theres a python module for gpio?
So this used to work verbatim. the second ampersand is b/c the python script never returns so i would like to Omega LED to stop flashing and finish the boot sequence. Also, the device is used as an AVR Programmer using AVR dude (from the arduino dock 2 package with a modified avrdude config file), so the device shouldn't be powered on longer than a single day. I could possibly remove the ampersand from the setup line.
I removed the setup shell and replaced it with the gpiomux commands directly and that seem to correct my issues
also the python pyGPIO module has a bug in it that I can't spend time trying to address ATM. So i just worked around it.