rpirena/www/etc/rc.local

30 lines
750 B
Text
Raw Permalink Normal View History

#!/bin/sh -ev
#
# 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 %s\n" "$_IP"
fi
chmod g+rw /dev/spidev*
chgrp spi /dev/spidev*
cd ~stephan/rpirena || exit 0
[ -e auto-run ] || exit 0
killall -s 0 -r 'rpirena(-auto)?.py' && exit 0
mv data/rpirena-auto.log~ data/rpirena-auto.log~~ || true
mv data/rpirena-auto.log data/rpirena-auto.log~ || true
su stephan -c ./rpirena-auto.py >data/rpirena-auto.log 2>&1 &
exit 0