2010-01-13 13:27:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# chkconfig: - 91 35
|
2019-01-14 18:24:24 +00:00
|
|
|
# description: Starts and stops the Uhub ( https://www.uhub.org ) daemons on RHEL\CentOS \
|
2010-01-13 13:27:07 +00:00
|
|
|
# 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
|
|
|
|
|
2012-06-13 10:30:17 +00:00
|
|
|
# Check that bin and uhub.conf exists.
|
|
|
|
[ -f $UHUBBINFILE ] || exit 6
|
2010-01-13 13:27:07 +00:00
|
|
|
[ -f /etc/uhub/uhub.conf ] || exit 6
|
|
|
|
|
|
|
|
RETVAL=0
|
|
|
|
|
|
|
|
|
|
|
|
start() {
|
2010-02-01 09:22:12 +00:00
|
|
|
KIND="Uhub"
|
2010-01-13 13:27:07 +00:00
|
|
|
echo -n $"Starting $KIND services: "
|
2012-06-13 10:30:17 +00:00
|
|
|
daemon $UHUBBINFILE $UHUBOPTIONS
|
2010-01-13 13:27:07 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo ""
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2010-02-01 09:22:12 +00:00
|
|
|
KIND="Uhub"
|
2010-01-13 13:27:07 +00:00
|
|
|
echo -n $"Shutting down $KIND services: "
|
2012-06-13 10:30:17 +00:00
|
|
|
killproc $UHUBBINFILE
|
2010-01-13 13:27:07 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo ""
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
reload() {
|
|
|
|
echo -n $"Reloading uhub.conf / user.conf file: "
|
|
|
|
killproc uhub -HUP
|
|
|
|
RETVAL=$?
|
|
|
|
echo ""
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
2010-07-30 07:35:36 +00:00
|
|
|
relog() {
|
|
|
|
echo -n $"Reopen main log file: "
|
|
|
|
killproc uhub -SIGHUP
|
|
|
|
RETVAL=$?
|
|
|
|
echo ""
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
2010-01-13 13:27:07 +00:00
|
|
|
rhstatus() {
|
2012-06-13 10:30:17 +00:00
|
|
|
status $UHUBBINFILE
|
2010-07-29 08:26:55 +00:00
|
|
|
RETVAL=$?
|
|
|
|
if [ $RETVAL -ne 0 ] ; then
|
|
|
|
return $RETVAL
|
|
|
|
fi
|
|
|
|
}
|
2010-01-13 13:27:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
reload
|
|
|
|
;;
|
2010-07-30 07:35:36 +00:00
|
|
|
relog)
|
|
|
|
relog
|
|
|
|
;;
|
2010-01-13 13:27:07 +00:00
|
|
|
status)
|
|
|
|
rhstatus
|
|
|
|
;;
|
|
|
|
*)
|
2010-07-30 07:35:36 +00:00
|
|
|
echo $"Usage: $0 {start|stop|restart|reload|relog|status}"
|
2010-01-13 13:27:07 +00:00
|
|
|
exit 2
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $?
|