1#!/bin/bash 2# 3### BEGIN INIT INFO 4# Provides: passivedns 5# Required-Start: $network 6# Required-Stop: $network 7# Default-Start: 2 3 4 5 8# Default-Stop: 0 1 6 9# Short-Description: Passive DNS collector 10# Description: This is a network (security) tool designed to 11# collect DNS information for troubleshooting or 12# security related work 13### END INIT INFO 14 15NAME=passivedns 16PIDFILE=/var/run/passivedns.pid 17DAEMON=/usr/bin/$NAME 18ARGS="-i eth0 -D" 19 20# Source default configs. 21if [ -r /etc/default/passivedns ]; then 22 . /etc/default/passivedns 23fi 24 25# See how we were called. 26case "$1" in 27 start) 28 echo -n "Starting $NAME ..." 29 $DAEMON $ARGS > /dev/null 2>&1 30 echo " done." 31 ;; 32 stop) 33 echo -n "Stopping $NAME ..." 34 start-stop-daemon --oknodo --stop --quiet --pidfile=$PIDFILE --exec $DAEMON 35 rm -f $PIDFILE > /dev/null 2>&1 36 echo " done." 37 ;; 38 restart) 39 $0 stop 40 $0 start 41 ;; 42 status) 43 if [ -f $PIDFILE ]; then 44 PID=`cat $PIDFILE` 45 ps -p $PID > /dev/null 2>&1 46 RC=$? 47 if [ "$RC" == "0" ]; then 48 echo "PassiveDNS is running with PID $PID..." 49 else 50 echo "PassiveDNS is not running..." 51 fi 52 else 53 echo "PassiveDNS is not running..." 54 fi 55 ;; 56 force-reload) 57 $0 stop 58 $0 start 59 ;; 60 *) 61 echo "Usage: $0 {start|stop|restart|force-reload|status}" 62 exit 1 63esac 64 65exit 0 66 67