Persistent Packet Capture
#!/bin/sh # # Startup script for persistent tcpdump # # chkconfig: 345 86 14 # description: Packet Capture # processname: tcpdump PCAP=/mnt/tcpdump/tcpdump.pcap SIZE=100 COUNT=20 PIDFILE=/var/run/tcpdump start() { if [ -f $PIDFILE ]; then echo "PID File $PIDFILE exists" exit 1 fi tcpdump -nn -w $PCAP -s0 -C $SIZE -W $COUNT -Z root not port 22 > /dev/null 2>&1 & echo $! > $PIDFILE exit 0 } stop() { if [ ! -f $PIDFILE ]; then echo "PID File $PIDFILE does not exist"