Dear All,
We have the pfcount to run as system script where below is the
skeleton we use to set it. The problem during the loading of the os we
notice after the crond is loaded this service is load and it shows the
packet start to capture but never able to load the full os and restart
there after. How to run it as script without any issue to the os ?
#!/bin/bash
# chkconfig: 2345 95 05
# myapp daemon
# description: myapp daemon
# processname: myapp
DAEMON_PATH="/usr/local/bin/"
DAEMON=myap1.c
#DAEMONOPTS="-my opts"
NAME=myap1.c
DESC="my packet capture"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
case "$1" in
start)
printf "%-50s" "Starting $NAME..."
insmod /usr/local/pfring/kernel/pf_ring.ko
/usr/local/bin/myap1.c
#cd $DAEMON_PATH
#PID=`$DAEMON > /dev/null 2>&1 & echo $!`
#echo "Saving PID" $PID " to " $PIDFILE
# if [ -z $PID ]; then
# printf "%s\n" "Fail"
# else
# echo $PID > $PIDFILE
# printf "%s\n" "Ok"
# fi
;;
status)
printf "%-50s" "Checking $NAME..."
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
printf "%s\n" "Process dead but pidfile exists"
else
echo "Running"
fi
else
printf "%s\n" "Service not running"
fi
;;
stop)
printf "%-50s" "Stopping $NAME"
PID=`cat $PIDFILE`
cd $DAEMON_PATH
if [ -f $PIDFILE ]; then
kill -HUP $PID
printf "%s\n" "Ok"
rm -f $PIDFILE
else
printf "%s\n" "pidfile not found"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {status|start|stop|restart}"
exit 1
esac
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc