#!/bin/bash # # honeyd This shell script takes care of starting and stopping DTNd. # # chkconfig: 345 55 45 # description: A Delay Tolerant Networking (DTN) reference implementation # processname: dtnd # pidfile: /var/run/dtnd.pid # config: /etc/dtn.conf # config: /etc/sysconfig/dtnd # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 [ -f /etc/dtn.conf ] || exit 0 [ -f /usr/sbin/dtnd ] || exit 0 [ -f /etc/sysconfig/dtnd ] && . /etc/sysconfig/dtnd # See how we were called. case "$1" in start) if [ -n "`/sbin/pidof dtnd`" ]; then echo -n "DTN daemon already running" echo exit 1 fi echo -n "Starting DTN daemon: " daemon /usr/sbin/dtnd --daemonize \ ${DTND_OUTPUT:-"--output /var/log/dtnd/dtnd.log"} \ ${DTND_LEVEL:-"-l warn"} \ ${DTND_CONF:-"--conf /etc/dtn.conf"} \ ${DTND_OPTIONS:-""} RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dtnd ;; stop) echo -n "Stopping DTN daemon: " killproc dtnd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dtnd ;; status) status dtnd RETVAL=$? ;; restart|reload) $0 stop $0 start RETVAL=$? ;; condrestart) [ -f /var/lock/subsys/dtnd ] && restart ;; *) echo "Usage: $0 {start|stop|status|restart|condrestart|reload}" exit 1 esac exit $RETVAL