c4055b7
#!/bin/sh
c4055b7
#
c4055b7
# flow-capture Capture traffic flow data
c4055b7
#
c4055b7
# chkconfig: - 90 10
c4055b7
# description: Capture traffic flow data
c4055b7
c4055b7
### BEGIN INIT INFO
c4055b7
# Provides: flow-capture
c4055b7
# Required-Start: $local_fs $network
c4055b7
# Required-Stop: $local_fs $network
c4055b7
# Default-Stop: 0 1 2 3 4 5 6
c4055b7
# Short-Description: Capture traffic flow data
c4055b7
# Description: Capture traffic flow data
c4055b7
### END INIT INFO
c4055b7
c4055b7
# Source function library.
c4055b7
. /etc/rc.d/init.d/functions
c4055b7
c4055b7
prog="flow-capture"
c4055b7
exec="/usr/bin/$prog"
c4055b7
config="/etc/sysconfig/$prog"
c4055b7
lockfile=/var/lock/subsys/$prog
c4055b7
c4055b7
[ -e $config ] && . $config
c4055b7
c4055b7
# Define the flow-tools username
c4055b7
FLOWTOOLS_USER="${FLOWTOOLS_USER:-flow-tools}"
c4055b7
c4055b7
# Add pidfile
c4055b7
OPTIONS="-p /var/run/flow-capture.pid $OPTIONS"
c4055b7
c4055b7
# Check that networking is up.
c4055b7
if [ "$NETWORKING" = "no" ]
c4055b7
then
c4055b7
        exit 0
c4055b7
fi
c4055b7
c4055b7
start() {
c4055b7
    [ -x $exec ] || exit 5
c4055b7
    [ -f $config ] || exit 6
c4055b7
    echo -n $"Starting $prog: "
c4055b7
    # if not running, start it up here, usually something like "daemon $exec"
c4055b7
    daemon --user=$FLOWTOOLS_USER $exec $OPTIONS
c4055b7
    retval=$?
c4055b7
    echo
c4055b7
    [ $retval -eq 0 ] && touch $lockfile
c4055b7
    return $retval
c4055b7
}	
c4055b7
c4055b7
stop() {
c4055b7
    echo -n $"Stopping $prog: "
c4055b7
    killproc $prog
c4055b7
    retval=$?
c4055b7
    echo
c4055b7
    [ $retval -eq 0 ] && rm -f $lockfile
c4055b7
    return $retval
c4055b7
}
c4055b7
c4055b7
restart() {
c4055b7
    stop
c4055b7
    start
c4055b7
}
c4055b7
c4055b7
reload() {
c4055b7
    restart
c4055b7
}
c4055b7
c4055b7
force_reload() {
c4055b7
    restart
c4055b7
}
c4055b7
c4055b7
rh_status() {
c4055b7
    # run checks to determine if the service is running or use generic status
c4055b7
    status $prog
c4055b7
}
c4055b7
c4055b7
rh_status_q() {
c4055b7
    rh_status >/dev/null 2>&1
c4055b7
}
c4055b7
c4055b7
case "$1" in
c4055b7
    start)
c4055b7
        rh_status_q && exit 0
c4055b7
        $1
c4055b7
        ;;
c4055b7
    stop)
c4055b7
        rh_status_q || exit 0
c4055b7
        $1
c4055b7
        ;;
c4055b7
    restart)
c4055b7
        $1
c4055b7
        ;;
c4055b7
    reload)
c4055b7
        rh_status_q || exit 7
c4055b7
        $1
c4055b7
        ;;
c4055b7
    force-reload)
c4055b7
        force_reload
c4055b7
        ;;
c4055b7
    status)
c4055b7
        rh_status
c4055b7
        ;;
c4055b7
    condrestart|try-restart)
c4055b7
        rh_status_q || exit 0
c4055b7
        restart
c4055b7
        ;;
c4055b7
    *)
c4055b7
        echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
c4055b7
        exit 2
c4055b7
esac
c4055b7
exit $?