From 4771fc729513128b7f23cb8eee59cd80439a7f13 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Tue, 25 Dec 2012 16:57:25 +0000 Subject: [PATCH] Added Redhat init.d script, contributed by Mark Jenks --- start_scripts/Redhat/weewx | 84 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 start_scripts/Redhat/weewx diff --git a/start_scripts/Redhat/weewx b/start_scripts/Redhat/weewx new file mode 100755 index 00000000..675c10ca --- /dev/null +++ b/start_scripts/Redhat/weewx @@ -0,0 +1,84 @@ +#!/bin/sh +# +# Author: Mark Jenks +# +# Startup script for Redhat derivatives +# +# weewx This shell script takes care of starting and stopping +# the weewx weather systen. +# +### BEGIN INIT INFO +# Provides: weewx +# Required-Start: $local_fs $syslog $time +# Required-Stop: $local_fs $syslog $time +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: weewx weather system +# Description: Manages the weewx weather system +# +### END INIT INFO +# +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +WEEWX_ROOT=/home/weewx +DESC="Weewx weather system" +NAME=weewx +WEEWX_USER=root:root +DAEMON=$WEEWX_ROOT/bin/weewxd.py +PIDFILE=/var/run/$NAME.pid +LOCKFILE=/var/lock/subsys/weewx +DAEMON_ARGS="--daemon --pidfile=$PIDFILE $WEEWX_ROOT/weewx.conf" +SCRIPTNAME=/etc/init.d/$NAME + +# Source function library. +. /etc/init.d/functions + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# See how we were called. +case "$1" in + start) + # Start daemon. + echo -n $"Starting weewx: " + daemon $DAEMON $DAEMON_ARGS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $LOCKFILE + ;; + stop) + # Stop daemon. + echo -n $"Shutting down weewx: " + killproc weewx + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + ;; + status) + echo -n $"Checking for weewx: " + status weewx + RETVAL=$? + ;; + restart) + echo -n $"Restarting weewx: " + $0 stop + $0 start + ;; + reload) + echo -n $"Reloading weewx: " + killproc weewx -HUP + RETVAL=$? + echo + ;; + condrestart) + [ -f $LOCKFILE ] && restart || : + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload}" + RETVAL=1 + ;; +esac + +exit $RETVAL