This is staring to do my head in!
Code: Select all
uname -a:
Linux raspbmc 3.10.36 #4 PREEMPT Sun Apr 13 21:25:32 UTC 2014 armv6l GNU/LinuxCode: Select all
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Log start of script
logger -s "`date` Starting rc.local"
#Monitor the UPiS for running on battery and shutdown as required
logger -s "`date` Start Monitoring UPiS"
/home/pi/bin/shutdown-after-power-loss.sh &
#Monitor the shutdown button on the UPiS
#sudo python /home/pi/bin/fwshut.py.
#Use UPiS to set clock - FIXME
#logger -s "`date` Setting Clock"
#echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device.
#hwclock -s
# This may be needed by minidlna to get inotify to work properly
logger -s "`date` Setup inotify node"
mknod /dev/inotify c 10 63
#Not sure if minidlna starts correctly uncomment below to force
logger -s "`date` delay 60s start minidlna"
sleep 60 && sudo service minidlna start
logger -s "`date` Ending rc.local"
exit 0
After boot, and using ssh to obtain a terminal it is possible to start rc.local correctly using
Code: Select all
sudo service rc.local startCode: Select all
#
#/etc/init/my-jobs.conf
#
description "Replacement Slot for rc.local"
start on local-filesystems
script
#Just wait a little while to be sure
sleep 10
# Log start of script
logger -s "`date` Starting my-job"
#Monitor the UPiS for running on battery and shutdown as required
logger -s "`date` Start Monitoring UPiS"
/home/pi/bin/shutdown-after-power-loss.sh &
#Monitor the shutdown button on the UPiS
#sudo python /home/pi/bin/fwshut.py.
#Use UPiS to set clock - FIXME
#logger -s "`date` Setting Clock"
#echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device.
#hwclock -s
# This may be needed by minidlna to get inotify to work properly
logger -s "`date` Setup inotify node"
mknod /dev/inotify c 10 63
#Not sure if minidlna starts correctly uncomment below to force
logger -s "`date` delay 60s start minidlna"
sleep 60 && sudo service minidlna start
logger -s "`date` Ending my-job"
end script
Code: Select all
start my-jobsIt does not however appear to start after a reboot
I put in the sleep 10 to make sure the logging service was running, but I am currently stumped how to get either rc.local or the uspstart script to work at boot.
Any suggestions gratefully received.
Regards,
Steve