dtn.init.d

Go to the documentation of this file.
00001 #!/bin/bash
00002 #
00003 # dtnd          Start the DTN daemon
00004 #
00005 # The variables below are NOT to be changed.  They are there to make the
00006 # script more readable.
00007 #
00008 # This script was modified from the apache rc script
00009 
00010 NAME=dtnd
00011 DAEMON=/usr/bin/$NAME
00012 CONTROL=/usr/bin/$NAME-control
00013 ARGS="-d -o /var/log/dtnd.log"
00014 PIDFILE=/var/run/$NAME.pid
00015 # note: SSD is required only at startup of the daemon.
00016 SSD=`which start-stop-daemon`
00017 ENV="env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin"
00018 
00019 trap "" 1
00020 
00021 cd /
00022 
00023 should_start() {
00024     if [ ! -x $DAEMON ]; then
00025         echo "$NAME is not executable, not starting"
00026         exit 0
00027     fi
00028 }
00029 
00030 case "$1" in
00031   start)
00032     echo -n "Starting DTN daemon..."
00033     should_start
00034     start-stop-daemon --start --exec $DAEMON -- $ARGS
00035     ;;
00036 
00037   start_tidy)
00038     should_start
00039     echo -n "Starting DTN daemon (tidy mode)..."
00040     $ENV $DAEMON $ARGS -t > /dev/null 2>/dev/null &
00041     ;;
00042 
00043   stop)
00044     echo -n "Stopping DTN daemon..."
00045     $CONTROL stop
00046     ;;
00047 
00048   restart)
00049     echo -n "Restarting DTN daemon..."
00050     $CONTROL stop
00051     $ENV $DAEMON $ARGS > /dev/null 2>/dev/null &
00052     ;;
00053 
00054   logrotate)
00055     echo -n "Rotating logs for DTN daemon..."
00056     $CONTROL logrotate
00057     ;;
00058 
00059   *)
00060     echo "Usage: /etc/init.d/$NAME {start|start_tidy|stop|restart|logrotate}"
00061     exit 1
00062     ;;
00063 esac

Generated on Thu Jun 7 12:54:26 2007 for DTN Reference Implementation by  doxygen 1.5.1