Date: Tue, 22 Mar 2016 15:07:41 +0100 From: Andrea Venturoli <ml@netfence.it> To: questions@freebsd.org Subject: RC script not working Message-ID: <56F151AD.7090009@netfence.it>
next in thread | raw e-mail | index | archive | help
Hello.
I've installed WeeWX in a jail and found the following startup script
somewhere:
> #!/bin/sh
> # Start script for FreeBSD, contributed by user Fabian Abplanalp
> # Adjust app and cfg locations as appropriate, then put this script
> # in /usr/local/etc/rc.d
> #
> WEEWX_BIN="/home/weewx/bin/weewxd"
> WEEWX_CFG="/home/weewx/weewx.conf"
> PIDFILE="/var/run/weewx.pid"
>
> case "$1" in
> "start")
> echo "Starting weewx..."
> /usr/local/bin/python ${WEEWX_BIN} ${WEEWX_CFG} --daemon &
> echo $! > ${PIDFILE}
> echo "done"
> ;;
>
> "stop")
> echo "Stopping weewx..."
> if [ -f ${PIDFILE} ] ; then
> kill `cat ${PIDFILE}`
> rm ${PIDFILE}
> echo "done"
> else
> echo "not running?"
> fi
> ;;
>
> "restart")
> echo "Restarting weewx..."
> $0 stop
> sleep 2
> $0 start
> ;;
>
> *)
> echo "$0 [start|stop|restart]"
> ;;
>
> esac
It works if I issue "service weewx [start|stop|restart]", but it won't
start the program on boot (or on jail restart).
Why?
Any sample of a rc.d script to start a Python deamon?
bye & Thanks
av.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56F151AD.7090009>
