Need help howto make a script for Set SNOOP run for 5 minutes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help howto make a script for Set SNOOP run for 5 minutes
# 1  
Old 05-26-2009
Need help howto make a script for Set SNOOP run for 5 minutes

Hi all,

I want to monitoring my interface every 6 hours where i want to run snoop command to capture all packet through the interface, so i want running snoop then snoop will run for 5 minutes after that snoop stop then will start again after 6 hours than run for 5 minutes again.

thereis any guide for me how to start that script?
# 2  
Old 05-26-2009
use crontab or at command
# 3  
Old 05-26-2009
ok i try using crontab, that run for every 6 hours but snoop never stop.. i want to make it just running for 5 minutes
# 4  
Old 05-26-2009
here is a hint Smilie

Code:
run snoop in background
get the background process pid using $!
sleep for 300 seconds
once done, kill $!

then you are done
# 5  
Old 05-26-2009
get the background process pid using $!

How to get it ?
are u have a sampe of script?
# 6  
Old 05-27-2009
Quote:
Originally Posted by tindasz
get the background process pid using $!

How to get it ?
are u have a sampe of script?
this is what you have to do
Code:
 
 snoop &
PID=`echo $!`
sleep 600
kill -9 $PID

# 7  
Old 05-27-2009
Or you can capture it using grep and awk

Code:
PID=`ps -ef | grep snoop | awk '{print $2}'`
kill -9 $PID

[ $2 or $3 in awk depending on your output]


-Devaraj Takhellambam
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Modify Sleeper script to run every 30 minutes

I would like to modify the below sleeper script to run every 30 minutes at the 29th and 59th minute of the hour. The below script is designed to run every 10 minutes and send an argument to the other script at a particular hour but i want it to run every 30 mins at the 29th and 59th minute of... (6 Replies)
Discussion started by: senormarquez
6 Replies

2. Shell Programming and Scripting

Run a script continuously for 10 minutes

Hi all!! Im using ksh and my OS is Linux. I want to run a script for ten minutes, starting from my current system time. How to acheive this? Any help appreciated. Thanks in advance (5 Replies)
Discussion started by: Jayaraman
5 Replies

3. Shell Programming and Scripting

help to make script run recursively

I have this little bash script I use to transcode mkv files using handbrake. #!/bin/bash sourcedir="/media/raid10/video/to_be_encoded_series" destdir="/media/raid10/video/series" cd "$sourcedir" for i in *.mkv; do HandBrakeCLI -i "$i" -o "$destdir/${i%.*}.mkv" -e x264 -q 20.0 -E copy -B... (4 Replies)
Discussion started by: barrydocks
4 Replies

4. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

5. Shell Programming and Scripting

how we can make shell script not to run

Hi,shell script is scheduled from maestro and we want mastero should not run shell script so can we edit the shell script so that it should run.ThanksPrakash (5 Replies)
Discussion started by: prakashdba2010
5 Replies

6. UNIX for Dummies Questions & Answers

Run the shell script for every 15 minutes?

I want to run my shell script for every 15 minutes starting from 12:20AM. I am passing parameter GA to shell script. Does this work? Any one please comment on this? 20 0-23/15 * * * xyz.sh 'GA' > xyz.log 2>&1 (9 Replies)
Discussion started by: govindts
9 Replies

7. Shell Programming and Scripting

How to run a script everyday between 7 and 8 pm with the time interval of 5 minutes?

Hi, Can someone help me in running a cronjob everyday between 7 and 8 pm with the time interval of 5 minutes in between to repeat that script. The script is so small and I need that to run daily between this time. Please if possible provide me the syntax for this logic. Thanks. (4 Replies)
Discussion started by: cya
4 Replies

8. Shell Programming and Scripting

howto run remotely call function from within script

Hi I have the following script : #!/bin/ksh #################### Function macAddressFinder ######################## macAddressFinder() { `ifconfig -a > ipInterfaces` `cat ipInterfaces` } ####################################################################### # # print... (2 Replies)
Discussion started by: presul
2 Replies

9. Shell Programming and Scripting

Script to run every 5 minutes

Hello all, I want to run a script every 5 minutes. How to accomplish this task? Thanks in advance Mrudula (12 Replies)
Discussion started by: mrudula009
12 Replies

10. Shell Programming and Scripting

Can anyone make this script run faster?

One of our servers runs Solaris 8 and does not have "ls -lh" as a valid command. I wrote the following script to make the ls output easier to read and emulate "ls -lh" functionality. The script works, but it is slow when executed on a directory that contains a large number of files. Can anyone make... (10 Replies)
Discussion started by: shew01
10 Replies
Login or Register to Ask a Question