Added Redhat init.d script, contributed by Mark Jenks

This commit is contained in:
Tom Keffer
2012-12-25 16:57:25 +00:00
parent 8f04ac5e33
commit 4771fc7295

84
start_scripts/Redhat/weewx Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/sh
#
# Author: Mark Jenks <mjenks@netnet.net>
#
# 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