Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Bash Script to kill some instances

Avatar of multisites
multisites asked on
Shell Scripting
5 Comments1 Solution496 ViewsLast Modified:
Hi,

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:

kill 6059
kill 3219

Thanks a lot.

Mario./
ASKER CERTIFIED SOLUTION
Avatar of Harisha M G
Harisha M GFlag of India imageEngineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers