Sponsored Content
Top Forums Shell Programming and Scripting Script to capture snoop output Post 302406085 by amitranjansahu on Monday 22nd of March 2010 01:32:40 AM
Old 03-22-2010
I have a idea we send the snoop to back ground. Then we can have a separate pid for it.

After 5 mins kill that pid with INT signal ( same as CTRL+C).

Code:
#!/bin/bash -x
file=amit123
echo $file
nohup  snoop -P > $file &
sleep 300
echo $!
kill -INT $!

  if [ -e $file ]
  then
    echo "File created"
else
echo "some error occured"
  fi
  echo "Snoop completed"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture output from interactive script

I have written a menu driven script to walk users through bringing up and down an application process. Sometimes the user tells me the script does not work taking the application down, but he can't recall seeing an error message. Is there a way to capture std out and stderr out from an... (6 Replies)
Discussion started by: MizzGail
6 Replies

2. UNIX for Dummies Questions & Answers

how to capture multicast packets using snoop

How do I use snoop command to capture multicast packets in the network? (1 Reply)
Discussion started by: caden312
1 Replies

3. Shell Programming and Scripting

Snoop Script

Hi, I want to write a script that checks an interface with the snoop command, if there is no traffic in 10 minutes on port 123 from the ip add 10.*.*.* it should send a e-mail.but i don't know how to start writing this script does anybody have an idea or an sample script that i can modifi. ... (2 Replies)
Discussion started by: tafil
2 Replies

4. Shell Programming and Scripting

script to capture certain output

Hi All, I want to create a script that capture only Date & Time, Current CPU % usage, Disk % usage, Mem % usage and Top process based on this output; Data Collected: 05/17/08 17:19:49 Refresh Interval: 600 seconds GlancePlus Started/Reset: 05/17/08 08:19:45 B3692A GlancePlus... (18 Replies)
Discussion started by: fara_aris
18 Replies

5. Shell Programming and Scripting

Capture Shell Script Output To A File

Hi, I am running a shell script called dbProcess.sh which performs shutdown and startup of various Oracle instances we have.At the time of execution the script produces the following output to the command line window $./dbProcess.sh stop #### Run Details ###### Hostname : server-hop-1... (4 Replies)
Discussion started by: rajan_san
4 Replies

6. Solaris

Snoop perl script

Hi , I would like to write a perl script with the snoop command to capture packets from a specific IP address to a node (incoming packets) and packets from that node for the same session to another node and save the capture to a file. I would like my script to be able to read my IP all the time... (7 Replies)
Discussion started by: Pouchie1
7 Replies

7. Shell Programming and Scripting

Parse snoop output

Hi all, Is it possible to create an script that parse an snoop output similar to the example above ? Each line is ended by "$" (set list in vi). as a result, I would like to print the output in only one line. can someone give me some tip ? Thanks a lot .:) l version="1.0" ... (5 Replies)
Discussion started by: robdcb
5 Replies

8. Shell Programming and Scripting

snoop script in background

Hi I want to write a script for snoop which can do snoop for 30 min and then process should be killed automatically I am using below codes #!/usr/bin/ksh snoop -d igb0 -o /opt/temp/abc.pcap sleep 1500 kill -9 `ps -ef|grep -i snoop |grep -v grep|awk '{print $2}'` But process is not... (3 Replies)
Discussion started by: anish19
3 Replies

9. Solaris

How to read the output of snoop command?

Hi! I have run the following command: snoop -q -d e1000g0 -o /var/tmp/optima0.txt & them I am trying to read the output of it with snoop -i /var/tmp/optima0.txt, which is giving me this: # snoop -i /var/tmp/optima0.txt | more 1 0.00000 AIOPTSVR -> 10.100.4.72 TCP D=1393 S=22 Push... (8 Replies)
Discussion started by: fretagi
8 Replies

10. Shell Programming and Scripting

Capture output from expect script

Hi I am new to Expect scripting. I have to connect to a remote server and capture the output. Here I need output of " send "list registered\r"" to be stored in a file. but after execution, /tmp/capture.txt is of 0 byte #!/usr/bin/expect spawn ssh abc@10.10.10.10 -p 5022 expect... (2 Replies)
Discussion started by: bns928
2 Replies
iopending(1m)							   USER COMMANDS						     iopending(1m)

NAME
iopending - plot number of pending disk events. Uses DTrace. SYNOPSIS
iopending [-c] [-d device] [-f filename] [-m mount_point] [interval [count]] DESCRIPTION
This samples the number of disk events that are pending and plots a distribution graph. By doing this the "serialness" or "parallelness" of disk behaviour can be distinguished. A high occurance of a pending value of more than 1 is an indication of saturation. Since this uses DTrace, only users with root privileges can run this command. OPTIONS
-c clear screen -d device instance name to snoop (eg, dad0) -f filename full pathname of file to snoop -m mount_point mountpoint for filesystem to snoop EXAMPLES
Default output, print I/O summary every 1 second, # iopending Print 10 second samples, # iopending 10 Print 12 x 5 second samples, # iopending 5 12 Snoop events on the root filesystem only, # iopending -m / FIELDS
value number of pending events, 0 == idle count number of samples @ 1000 Hz load 1 min load average disk_r total disk read Kb for sample disk_w total disk write Kb for sample IDEA
Dr Rex di Bona DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver- bose descriptions explaining the output. EXIT
iopending will run forever until Ctrl-C is hit, or the specified count is reached. AUTHOR
Brendan Gregg [Sydney, Australia] SEE ALSO
iosnoop(1M), iotop(1M), dtrace(1M) version 0.60 Nov 01, 2005 iopending(1m)
All times are GMT -4. The time now is 06:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy