#!/bin/bash # # yaf This shell script takes care of starting and stopping # yaf . # # chkconfig: - 58 74 # description: yaf is a flow collection process. ### BEGIN INIT INFO # Provides: yaf # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Short-Description: start and stop yaf # Description: ntpd is yaf process. ### END INIT INFO # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network prog=yaf INTERFACE=bond0 OPTIONS=' --silk --ipfix=tcp --live=pcap --in=$INTERFACE --out=127.0.0.1 --ipfix-port=18001 & ' start() { # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 1 [ -x /usr/bin/yaf ] || exit 5 # Start daemons. echo -n $"Starting $prog: " daemon $prog $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] return $RETVAL } stop() { echo -n $"Shutting down $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $prog ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 2 esac