So, first attempt at this so if there any glaring errors please let me know :) This is to start the daemon at boot. It does not check whether the daemon continues to run, or if it is logging.
This is a script to be placed in the /etc/init.d/ folder. Edit any of the variables to suit your system. Make it executable.
Test it using /etc/init.d/pywws-livelog-daemon start
check the status /etc/init.d/pywws-livelog-daemon status
stop it with /etc/init.d/pywws-livelog-daemon stop
It seems update-rc.d is being depreciated so I used insserv to set up the auto start links.
Firstly run it with the -n option which does not change anything. If it is OK then run it again without the -n
sudo insserv -n -v pywws-livelog-daemon
Reboot the pi and chcck the status.
Start code;
#!/bin/sh
### BEGIN INIT INFO
# Provides: pywws-livelog-daemon
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start pywws daemon
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
DAEMON=/usr/local/bin/pywws-livelog-daemon.py
PIDFILE=/var/run/pywws.pid
DATADIR=/home/pi/weather/data
LOGFILE=$DATADIR/live_logger.log
RUNASUSER=pi
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
case $1 in
start)
log_daemon_msg "Starting pywws service" "pywws"
if [ -z "$UGID" ]; then
log_failure_msg "user \"$RUNASUSER\" does not exist"
exit 1
fi
$DAEMON -v $DATADIR $LOGFILE start
status=$?
log_end_msg $status
;;
stop)
log_daemon_msg "Stopping pywws service" "pywws"
$DAEMON -v $DATADIR $LOGFILE stop
log_end_msg $?
rm -f $PIDFILE
;;
restart|force-reload)
$DAEMON -v $DATADIR $LOGFILE restart
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload)
exit 3
;;
status)
status_of_proc $DAEMON "pywws service"
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 2
;;
esac