The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl script to rotate logs theninja Shell Programming and Scripting 18 03-21-2008 03:06 PM
is there any way to excute script every N seconds? umen Shell Programming and Scripting 7 03-30-2006 04:06 AM
Check size and rotate log script. ashishT HP-UX 3 12-16-2005 06:43 PM
How to decipher tcpdump file diganta Security 3 02-24-2005 11:55 PM
TCPDump Binary File...... pydyer UNIX for Dummies Questions & Answers 8 12-18-2001 05:12 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-22-2006
livewire livewire is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 2
Help with script, trying to get tcpdump and rotate the file every 300 seconds

Greetings, I just started using scripting languages,
im trying to get a tcpdump in a file, change the
file name every 5mins ... this is what i have but its
not working ... any suggestions?

#!/bin/bash
# timeout.sh

#timestamp format
TIMESTAMP=`date -u "+%Y%m%dT%H%M%S"`

#tdump =`tcpdump -w dump.out -s 1514`
#tcpdump -w dump.out -s 1514 &

while sleep 2
do
echo starting tcpdump
#tcpdump -w dump.out -s 1514
tcpdump -s 5060 > dump.out
mv dump.out dump.out_${TIMESTAMP}
echo file output is dump.out_${TIMESTAMP}
done
  #2 (permalink)  
Old 11-22-2006
dhanamurthy dhanamurthy is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 105
I have two questions .

1. What is the error you are getting ?.
2. From your code i understand that it sleeps for 2 seconds and takes a tcpdump. But your requirement is for 5 minutes. Your script changes names for every two seconds.
Sleep takes seconds as its arugment.

Let me know if this helps ........
  #3 (permalink)  
Old 11-22-2006
livewire livewire is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 2
yes, i wanted to test it out and i left it for 2 seconds... any ideas on how to achieve this?
  #4 (permalink)  
Old 09-10-2008
pangrazi pangrazi is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 1
Try this

tcpdump -G 300
that will rotate the file every 5 minutes

more info is at the man page

Manpage of TCPDUMP
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0