I need a little Bash Script, to be executed as a cron job, say, each 30 minutes and just do:
1) Issue the command (lsof -i | grep irc) to see if there's any IRC connection established.
2) If there's not it will do nothing. If there is any, it shall list one or more lines like this:
named 6059 named 25u IPv4 20094 TCP briden.striger.ru:irc (LISTEN)
named 3219 named 25u IPv4 20094 TCP briden.striger.ru:irc -> nnn.nnn.nnn.nnn (ESTABLISHED)
3) In this case, it would kill all the instances listed, issuing, as in this example:
Thanks a lot.