OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Starting ospi.py automatically › Re: Re: Starting ospi.py automatically
August 25, 2013 at 2:04 pm
#24724
mikethechap
Participant
In addition to the question posted just above, I’m also having problems with it auto-starting and then going into the background. I am using a hard-wired version to the network (as of yesterday afternoon and evening – that was a ton of work). Here’s my rc.local file:
#!/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.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %sn" "$_IP"
fi
#echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
#hwclock -s
### Start the OSPi interval program
$host=$hostname -I | sed 's/ *$//g')
host=0.0.0.0
port=8080
cd /home/pi/OSPi/
nohup /usr/bin/python ospi.py $host:$port 2>&1 &
exit 0
I still have to manually start the program (change directory / sudo python ospi.py). And, it never goes into the background meaning I have to shut down putty. What could I be missing. It’s as though doesn’t know that it needs to go to the ospi on startup.