diff --git a/GNUnet/gnunetd.service b/GNUnet/gnunetd.service new file mode 100755 index 0000000..2988f79 --- /dev/null +++ b/GNUnet/gnunetd.service @@ -0,0 +1,105 @@ +#!/bin/sh +# +# gnunetd Starts gnunetd. +# +# +# chkconfig: 345 82 18 +# description: The GNUnet daemon, required for any GNUnet operations (searches, down‐loads, etc). + +WITHOUT_RC_COMPAT=1 + +# Source function library. +. /etc/init.d/functions + +SourceIfNotEmpty /etc/sysconfig/gnunetd + +GNUNETD=/usr/bin/gnunetd +[ -x "$GNUNETD" ] || exit + +GNUNETD_CONF=/etc/gnunetd.conf + +PIDFILE=/var/run/gnunetd/pid +LOCKFILE=/var/lock/subsys/gnunetd +RETVAL=0 + +start() +{ + msg_starting $"GNUNet daemon" + if [ -f "$GNUNETD_CONF" ]; then + start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce -- gnunetd $GNUNETD_OPTIONS + RETVAL=$? + else + passed + RETVAL=$? + echo + echo "GNUNet daemon is not configured" + fi + return $RETVAL +} + +stop() +{ + msg_stopping $"GNUNet daemon" + stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --no-announce gnunetd + RETVAL=$? + return $RETVAL +} + +restart() +{ + stop + start +} + +reload() +{ + msg_reloading $"GNUNet daemon" + stop_daemon --pidfile "$PIDFILE" -HUP gnunetd + RETVAL=$? + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status --pidfile "$PIDFILE" gnunetd + RETVAL=$? + ;; + restart) + restart + ;; + reload) + reload + ;; + condstart) + if [ ! -e "$LOCKFILE" ]; then + start + fi + ;; + condstop) + if [ -e "$LOCKFILE" ]; then + stop + fi + ;; + condrestart) + if [ -e "$LOCKFILE" ]; then + restart + fi + ;; + condreload) + if [ -e "$LOCKFILE" ]; then + reload + fi + ;; + *) + msg_usage "${0##*/} {start|stop|status|restart|reload|condstart|condstop|condrestart|condreload}" + RETVAL=1 +esac + +exit $RETVAL