Avatar of joaotelles
joaotellesFlag for United States of America

asked on 

Shell script and crontab question - Create new output file everyday

Hi,

Im looking for a way to have a command running 24hrs per day and generating an output file per day.

The command Im talking about is this one:

# ngrep -O dump.pcap -W byline -d xxxx port 99999
interface: xxxx
filter: (ip) and ( port 99999)
output: dump.pcap   <--- output file

So the goal would be to have it running all day long and every end of day it would generate a new file.. (not sure if its possible or not...)...
I thought on having something on the crontab that somehow would do this "switch" of files every end of day...

Just to illustrate what Im talking about if its not clear...:

1- The command would inside  script that would run on the background.. everyday on the crontab (not sure if its the best solution - the crontab one)

2- Every end of day it would generate a new output file (not sure if this is a code to go in the "script" itself or some command on the crontab).. so I would have:
dump<date_day_1>.pcap
dump<date_day_2>.pcap (created on the start of the "day 2"..
.
.

3- What would be your suggestion to have something that would delete files older than 10 days from the "script" output files? Something on the script itself? If so, can you suggestion a command line for this?

====

Tks,
Joao
Shell ScriptingUnix OS

Avatar of undefined
Last Comment
joaotelles
ASKER CERTIFIED SOLUTION
Avatar of simon3270
simon3270
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of joaotelles
joaotelles
Flag of United States of America image

ASKER

Tks.
Unix OS
Unix OS

Unix is a multitasking, multi-user computer operating system originally developed in 1969 at Bell Labs. Today, it is a modern OS with many commercial flavors and licensees, including FreeBSD, Hewlett-Packard’s UX, IBM AIX and Apple Mac OS-X. Apart from its command-line interface, most UNIX variations support the standardized X Window System for GUIs, with the exception of the Mac OS, which uses a proprietary system.

33K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo