#!/usr/local/bin/bash # # checkbnc script # # FREEBSD ONLY (linux/solaris do not have sockstat) # -- perhaps a future version for linux/solaris using lsof # Checks IRC connections of different processes and counts them # # Zoidial, Inc. # Eric Thern, 2001 # # v0.1 10/25/2001 - initial release, only checked BNC's # v0.2 11/03/2001 - added eggdrop, ircd, and ALL connections # v0.4 11/04/2001 - fixed egrep statement for less false positives # # -- NOTES -- # this is a bit wordy, and can be split into different scripts easily # if needed. just split any line beginning with the word "sockstat" and # put them in their own script for fast checking. # until test do echo "" echo "This script shows connections to IRC servers" echo "from both local-->remote and remote-->local" echo "" echo "1) Show BNC / Mech / Proxybot connections" echo "2) Show Eggdrop connections" echo "3) Show IRCd connections" echo "4) Show ALL IRC connections" echo "5) Quit" echo "" read test case $test in 1) echo "" echo "# = number of concurrent connections" echo " # User Process PID" echo "-----------------------------------" sockstat |egrep '(bnc|psybnc|ezbnc|ez|mech|emech|mirkforce|Mirkforce|iroffer|xdcc|sc_serv)' |egrep '(:666|:7000)' | awk '{print $1 "\t" $2 "\t\t" $3}' |uniq -c |more ;; 2) echo "" echo "# = number of concurrent connections" echo " # User Process PID" echo "-----------------------------------" sockstat |egrep '(egg)' |egrep '(:666|:7000)' | awk '{print $1 "\t" $2 "\t\t" $3}' |uniq -c |more ;; 3) echo "" echo "# = number of concurrent connections" echo " # User Process PID" echo "-----------------------------------" sockstat |egrep '(ircd)' |egrep '(:666|:7000)' | awk '{print $1 "\t" $2 "\t\t" $3}' |uniq -c |more ;; 4) echo "" echo "# = number of concurrent connections" echo " # User Process PID" echo "-----------------------------------" sockstat |egrep '(:666|:7000)' | awk '{print $1 "\t" $2 "\t\t" $3}' |uniq -c |more ;; 5) echo "Quitting." exit 0; ;; esac done