Here is a start script that I created for my redhat system.  I of course
blatantly stole it from some other init.d script so I'll blame the original
author (unnamed) for any bugs :)

Put the script in /etc/rc.d/init.d and use chkconfig to get it to start on
boot.  Use "/sbin/service nessusd stop" to stop the daemon.  Okay, it's a
lot of work to get kill executed, but it works.

Dion


###################################################################
#!/bin/sh
#
# nessusd This shell script takes care of starting and stopping
# nessusd (Nessus security scanner Daemon).
#
# chkconfig: 345 95 07
# description: Nessus is a security auditing tool.
# processname: nessusd
# config: /etc/nessus/nessusd.conf
# Source function library.
. /etc/init.d/functions

# -a 127.0.0.1 : restricted to localhost
OPTIONS="-a 127.0.0.1 "

# Make sure that nmap and whisker are in the daemon's path 
export PATH="/usr/local/bin:/usr/local/whisker:$PATH"
RETVAL=0

prog="nessusd"

start() {
echo -n $"Starting $prog: "
daemon /usr/local/sbin/nessusd $OPTIONS -D
RETVAL=$?
echo
}

stop() {
  echo -n $"Stopping $prog: "
  killproc /usr/local/sbin/nessusd
  RETVAL=$?
  [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nessusd
  echo
  return $RETVAL
}

restart() {
  stop
  start
}

status_nessus() {
  status /usr/local/sbin/nessusd
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  reload|restart)
    restart
    ;;
  condrestart)
    [ -f /var/lock/subsys/nessusd ] &&   restart
    ;;
  status)
    status_nessus 
    ;;
  *)
    echo $"Usage: $0 {start}"
    exit 1
  esac

exit $RETVAL

Reply via email to