![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
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 ........ |
|
||||
|
Try this
tcpdump -G 300 that will rotate the file every 5 minutes more info is at the man page Manpage of TCPDUMP |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|