Re: Need some small help on shell script - delete old files



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
.



Relevant Pages

  • rlogin via expect mysteriously aborts when run from cron
    ... I'm not sure whether this is a problem related to shell, ... I have an application which, at some point, executes a zsh script. ... When investigating the output which was sent to me from the cron job ... I had one case where even a command ...
    (comp.lang.tcl)
  • Re: Need some small help on shell script - delete old files
    ... recent dump is always left un-compressed with no .gz extension. ... The second dump has to be coming from an alternate CRON job or an AT ... If you have a script somewhere that is running between 2-3pm each day, ... starting around that time (remember that the time on the backup file ...
    (comp.unix.shell)
  • Re: Command to dump/restore user info OSR5
    ... Write a script that does a dump and then compares the current dump against the previous such dump. ... You don't have a diff unless you install the devsys or gnutools. ... The order of the filenames on the diff command line, and the way the script renumbers filenames, means that the first instance is the old password and the next instance is the new password. ...
    (comp.unix.sco.misc)
  • Re: Need some small help on shell script - delete old files
    ... command so that it does not search subdirectories past this directory ... The find command shows all files in the directory and subdirectories. ... I am using your script. ... recent dump is always left un-compressed with no .gz extension. ...
    (comp.unix.shell)
  • Re: rlogin via expect mysteriously aborts when run from cron
    ... I have an application which, at some point, executes a zsh script. ... When investigating the output which was sent to me from the cron job ... I had one case where even a command ...
    (comp.lang.tcl)