On 2014-01-20 6:51 AM, Neil Bothwick <n...@digimed.co.uk> wrote:
On Mon, 20 Jan 2014 06:38:40 -0500, Tanstaafl wrote:

The pertinent part of the script is:

# delete aged backup files, keeping 60 nightlies and 45 (5 days of)
hourlies rm $(ls -1t $MySQL_BACKUP_DIR_nightly/* | tail -n +61)
rm $(ls -1t $MySQL_BACKUP_DIR_hourly/* | tail -n +46)

It works fine and does what it is supposed to, but the email I get as a
result of the script running says only this in the body:

rm: missing operand
Try 'rm --help' for more information.

Do you have a file with an odd name in either of those directories,
particularly one starting with a -

No, they are all sql.gz files, starting with the date, like:

2014-01-05_0958-hostname-all.sql.gz

You could try adding "echo rm $(ls -1t ..." to the script to see what it
is actually trying to run.

Or you could use find instead

find $MySQL_BACKUP_DIR_nightly -type f -mtime +60 -exec rm {} +

Ok, may try that... thx...

Reply via email to