Timestamps in backup files?

lodp

Verified User
Joined
Sep 30, 2007
Messages
11
Hi everyone,

I've got daily automatic user backups set up on Reseller level. The resulting files are ftp'ed to a remote server. However, since the name of the created backup file is always the same (user.tar.gz), the backups get overwritten every day, and I don't get access to older backups.

How do I make DA get a timestamp into the filename, so that doesn't happen? Where's the script and how do I have to modify it?

I've browsed the forums a fair bit, but the only things I found were workarounds (like having different cronjobs for every weekday, or having the files renamed once they've been transfered to the remote server). Would be nice to have a little checkbox in DA, to toggle backup filenames with/without timestamps -- has that been requested?
 
ok, i resorted to that solution now, thanks for pointing out the instructions.

but it's relatively laborious to set up and modify -- couldn't this be built into DA as a featurewith a little more convenience?
would be great if you could automatically ftp backups into a single folder, have timestamps on them for ease of identification, and maybe have them auto-deleted when they've reached a certain age (the SQL backup application mysqldumper has that feature, apparently).

also, i'd like to point out a small glitch (or so i think) in the interface there: in the form for the backup cronjob (and in the HowTo), it says "Day of week (0-7)". Shouldn't it be 0-6? 0 being sunday, and 6=saturday?
 
Having gone through the procedure again, creating 7 separate cronjobs, I'd like to stress again what pain in the behind this is..

Plus for doing weekly backups that way you would have to create 52 cronjobs.

Why not enable optional timestamps in the filename?

And maybe (optionally) have it overwrite the oldest backup file when a custom maximum number of files is reached in the folder. Now THAT would be a convenient backup tool.
 
I used this fix for a long time but never saw it on this forum.
And when i updated i had to change it again.

So i thought it might help other people who are looking for this solution:

use timestamp in backup do this:

edit:
/usr/local/directadmin/scripts/ftp_upload.php

change:

$FTPPUT -f $CFG -V -t 25 -m "$ftp_path" "$ftp_local_file" 2>&1

to:

date=`date +'%Y-%m-%d'`
ftp_path=${ftp_path}/${date}/

$FTPPUT -f $CFG -V -t 25 -m "$ftp_path" "$ftp_local_file" 2>&1


So add those 2 lines above, and now the backup will be:

example:
(ftp dir) / 2009-05-06 / files
 
The problem with that and why I think DA has not implemented it yet is that eventually the hard drive will get filled up unless the admin is paying attention and manually deleting old backups.
 
greenm, seems a good solution. I'll test it.

@floyd, wouldn't that be the admins responsability? If a backup failed due to no free space available, the admin should delete older files. Perhaps, directadmin could check the ftp site for backups older than x days and delete them. That should be too hard i think.
 
DirectAdmin does not create the directory... and as it can't find the directory, it doesn't upload a thing... but i get no errors either... strange..

i would be happy to see the integrated feature.
 
Make sure your ftp directory has writable rights :)
--Quick reply heheh--
 
Back
Top