Hello,
I'm fairly new to Linux and although I can find my away around the basics and understand a lot of the concepts, I'm having trouble putting together a shell script to perform what seems like it should be a simple task!
I'm trying to write a shell script (that will be run as a cron job) to do the following:
tar/gzip all of the log files in a directory EXCEPT for the one with the current date (since it's still in use)
(I know the command to do this for ALL log files, but I can't figure out a way to exclude the current day's log file by its date (ctime) stamp.)
verify that the tar.gz file was successfully created
delete the individual log files that were added to the tar.gz file from the directory EXCEPT for the current day's log file
(Again, I know how to rm the files -- but, I want to rm all of them EXCEPT for the current day's log file.)
There are SO many unix/linux command switches and combinations of piped commands that it's frustrating to figure this out.
I'm sure it's a no-brainer for someone who's been using Linux for a while.
Thanks for your replies!
- d
Start Free Trial