Re: Need some small help on shell script - delete old files
- From: "steven_nospam at Yahoo! Canada" <steven_nospam@xxxxxxxx>
- Date: Fri, 3 Jul 2009 07:45:57 -0700 (PDT)
SteveN,
I am using your script.
1.) Is there any way that the script can be modified so that even the
last dump that it does gets gzipped? I am noticing that the most
recent dump is always left un-compressed with no .gz extension. The
following day, it will gzip any prior files and then create a new non-
gzipped dump.
2.) I am still getting a second dump at around 2-3pm each day
strangly. I have no other cron job running which would do this. What
is an "AT job" as quoted in your post on 06/15/2009 at 3:46pm?
Thank you!
David- Hide quoted text -
- Show quoted text -
Hi David,
As I mentioned, since the "ls" is supposed to be picking up ALL files
in the directory that match the criteria, it should be seeing all the
backups and gzipping them all. If it is missing the last one, this is
most likely a timing issue. You can try putting in a delay (sleep 60)
or use the "wait" command to see if it must delay the start of the
gzip until the mysqldump is completed. But in a script running
sequentially without nohup or background processes, I would have
expected them to be ready by the time it tries to gzip.
The second dump has to be coming from an alternate CRON job or an AT
job, especially if it is almost always happening at the same time
(between 2-3pm). The CRON is a daemon that lets you run jobs at set
schedules, at the same time on a specific day, etc. The AT command is
similar, except that it lets you specify a job to run "at" a later
time, and it is usually a one time submission. You can issue commands
like this:
echo "hello world" | at now + 10 min
If you use the "atq" command, it will show if there are any jobs
queued up for a later time.
If you have a script somewhere that is running between 2-3pm each day,
I would first check all of the entries in CRON for any that might be
starting around that time (remember that the time on the backup file
is when it completed, not when it started, so you may need to
calculate possible start time when looking for cron jobs)
Two other things you can do:
1) comment out the CRON entry for the script I gave you, and see if
the other backup still gets created at 2-3pm
2) run "ps -ef" commands and look for processes running between 2-3pm
to try and identify what is writing that extra backup file. The script
name or commands that create it should be showing at that time.
I'm afraid I can't help much more than that.
SteveN
.
- Follow-Ups:
- References:
- Prev by Date: I don't get why '>' doesn't get printed in the following example
- Next by Date: Re: I don't get why '>' doesn't get printed in the following example
- Previous by thread: Re: Need some small help on shell script - delete old files
- Next by thread: Re: Need some small help on shell script - delete old files
- Index(es):
Relevant Pages
|