diff --git a/doc/init.d.RedHat/etc/init.d/uhub b/doc/init.d.RedHat/etc/init.d/uhub new file mode 100755 index 0000000..f7db25c --- /dev/null +++ b/doc/init.d.RedHat/etc/init.d/uhub @@ -0,0 +1,101 @@ +#!/bin/sh +# +# chkconfig: - 91 35 +# description: Starts and stops the Uhub ( http://www.extatic.org/uhub ) daemons on RHEL\CentOS \ +# used to provide p2p network services. +# +# pidfile: /var/run/uhub.pid +# config: /etc/uhub/uhub.conf + + + +# Source function library. +if [ -f /etc/init.d/functions ] ; then + . /etc/init.d/functions +elif [ -f /etc/rc.d/init.d/functions ] ; then + . /etc/rc.d/init.d/functions +else + exit 1 +fi + +# Avoid using root's TMPDIR +unset TMPDIR + +# Source networking configuration. +. /etc/sysconfig/network + +if [ -f /etc/sysconfig/uhub ]; then + . /etc/sysconfig/uhub +fi + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 1 + +# Check that uhub.conf exists. +[ -f /etc/uhub/uhub.conf ] || exit 6 + +RETVAL=0 + + +start() { + KIND="UHUB" + echo -n $"Starting $KIND services: " + daemon uhub $UHUBOPTIONS + RETVAL=$? + echo "" + return $RETVAL +} + +stop() { + KIND="UHUB" + echo -n $"Shutting down $KIND services: " + killproc uhub + RETVAL=$? + echo "" + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading uhub.conf / user.conf file: " + killproc uhub -HUP + RETVAL=$? + echo "" + return $RETVAL +} + +rhstatus() { + status uhub + RETVAL=$? + if [ $RETVAL -ne 0 ] ; then + return $RETVAL + fi +} + + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + status) + rhstatus + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status}" + exit 2 +esac + +exit $? diff --git a/doc/init.d.RedHat/etc/sysconfig/uhub b/doc/init.d.RedHat/etc/sysconfig/uhub new file mode 100644 index 0000000..cb5f6d3 --- /dev/null +++ b/doc/init.d.RedHat/etc/sysconfig/uhub @@ -0,0 +1,15 @@ +# Options to UHUB +# -v Verbose mode. Add more -v's for higher verbosity. +# -q Quiet mode - no output +# -f Fork to background +# -l Log messages to given file (default: stderr) +# -L Log messages to syslog +# -c Specify configuration file (default: /etc/uhub/uhub.conf) +# -S Show configuration parameters, but ignore defaults +# -u Run as given user +# -g Run with given group permissions +# -p Store pid in file (process id) + + +UHUBOPTIONS=" -u uhub -f -p /var/run/uhub.pid -l /var/log/uhub.log" +