Scheduled backup date-named

sev3n

New member
Joined
Nov 23, 2006
Messages
3
Is there a way to have scheduled backup named as user and date?

Thanks
 
Nothing? A powerfull panel like DA doesnt support dated scheduled backup? :(
 
Let's go back to the beginning.

DA allows user (site owners) to create backups on demand, but not to schedule them.

DA allows resellers and admins to create backups to run at specific times using cron jobs.

DA does not store the date/time in the backup file, which is simply named username.tar.gz.

The backup manager suggested by xemaps will possibly work for admins, who can install and manage it through a shell login (and who may have to do extensive configuration or code changes to make it work for only specific users), but of course admins with shell access can also use the backups built into DA (the userbackup, the reseller backup, and the system backup) and then later shell in and change the name.

Jeff
 
another popular method of using the Reseller level backup is to create multiple remote (or local) ftp backups as cron jobs. Each one is set to run on a different day (eg, 7 per week, one for each day) and use a different path for each cron (sunday, monday, etc..). This would allow you to store the last 7 days (or however many you want), each with their own copies.

John
 
DirectAdmin Support said:
another popular method of using the Reseller level backup is to create multiple remote (or local) ftp backups as cron jobs. Each one is set to run on a different day (eg, 7 per week, one for each day) and use a different path for each cron (sunday, monday, etc..). This would allow you to store the last 7 days (or however many you want), each with their own copies.

John

Ok, but from DA i can expect more than this trick ... or shouldn't i?

Actually as reseller I've to rename every day the back-up file and it's a bit boring.

I hope DA Team will add this feature in the next release.

Good job guys ;)
 
Nothing? A powerfull panel like DA doesnt support dated scheduled backup? :(

Mmmm.. this is not entirely true I'm afraid, DA does support scheduled backups. However there a few few (imho) tiny features that are missing in order to give the DA backup system straight A's!

What I'm talking about is wildcards in backup filenames, and possibly wildcards in (remote) folder location.

For instance, instead of naming a backup username.tar.gz, it could be username-$weekno.tar.gz, or username-$yyyy$mm$dd.tar.gz and same with the backup location; I'd love to have the backups to be stored in /backups/$weekno!

For I have a fair knowledge of *nux, I think this should be fairly easy to implement. But then I could be wrong as I've never seen DA's structure.


So anyway.. dunno if that thread is still being followed... but I though I'd add my 2c! ;)

Cheers,

Seb.
 
Last edited:
I would like to see this too. Or, does anyone have a good script that will take the user backup file username.tar.gz and rename it to something like yyyymmdd.username.tar.gz or put it into a folder with the current date? As of now, I can only keep one day worth of user backups.
 
Okay, it's very primative at this time, but I've written a small script that can be scheduled through cron to run each night just after my backups. This script just takes the backup file and renames it with the current date for all resellers with user backups. There is a lot more that could be done with it, like deleting backups older than x number of days old, but I haven't got around to that yet. Any suggestions are welcome:

Code:
#!/bin/bash
 
homedir=/home
month=`date '+%m'`
day=`date '+%d'`
year=`date '+%Y'`
 
for users in $homedir/*; do
    user=${users:6}
    bkupdir=$users/user_backups
    oldbkupfile=$user.tar.gz
    newbkupfile=$year$month$day.$user.tar.gz
 
    if [ -d $users ]; then
        if [ -d $bkupdir ]; then
            if [ -f $bkupdir/$oldbkupfile ]; then
                mv $bkupdir/$oldbkupfile $bkupdir/$newbkupfile
            fi
        fi
    fi
done
 
Through further testing, it appears that my script does not work as I intended it to. I'll play around with it a little more and let you know if I get something working. Thanks.
 
I am not sure what we are talking about here but regular user backups done at the user level are already dated, at least in the latest DA.
 
DA allows user (site owners) to create backups on demand, but not to schedule them.

It can be done using the API and run as cron job.

http://www.directadmin.com/features.php?id=512

2. User Level Backups
CMD_API_SITE_BACKUP
method can be GET or POST.

###################
#list current available backup files
domain=domain.com (hidden value, doesn't affect the outcome of the backup, but is required)

###################
#create a backup
action=backup
domain=domain.com (hidden value, doesn't affect the outcome of the backup, but is required)

for the following items, include whichever ones you wish to include in the backup. The format is select0=<b>item</b>, where you would use select1=<b>item2</b> for the next item, etc.

domain
subdomain
email
forwarder
autoresponder
vacation
list
emailsettings
ftp
ftpsettings
database

See the Actual user backup page to see what each item does.

###################
#restore a backup
action=restore
domain=domain.com (hidden value, doesn't affect the outcome of the backup, but is required)
file=filename.tar.gz

Include the desired items using the same select0=item technique as above. Use the action=view command from below to see what items are actually available to restore.

###################
#view a backup file's contained items.
action=view
domain=domain.com (hidden value, doesn't affect the outcome of the backup, but is required)
file=filename.tar.gz

returns a list of selectable items (see the above list )
 
These are backups done from the reseller level for all of the reseller's users. Yes, when a user creates a backup they are date named. However, when a reseller creates a backup of his/her users, the files are not date named and are only named like user.tar.gz in the reseller's user_backups directory. This means they get overwritten overday, so you cannot keep more than one backup at a time. I'm just trying to find a way around this. Thanks.
 
Last edited:
How many backups are you planning on keeping? If not more than 7 days then you could do as DA Support suggested above.

Another thing you can do is create a script that renames the backup a minute before the backup is supposed to run.
 
another popular method of using the Reseller level backup is to create multiple remote (or local) ftp backups as cron jobs. Each one is set to run on a different day (eg, 7 per week, one for each day) and use a different path for each cron (sunday, monday, etc..). This would allow you to store the last 7 days (or however many you want), each with their own copies.

John

How do you do this? I don't see an option in the reseller level backup utility to change the path of a local user backup. The path seems to be hard-coded to /home/username/user_backups. Any help would be appreciated.
 
How many backups are you planning on keeping? If not more than 7 days then you could do as DA Support suggested above.

Another thing you can do is create a script that renames the backup a minute before the backup is supposed to run.

I'd like to have the retention period customizable, but I'll probably keep 7-14 days worth.
 
How do you do this? I don't see an option in the reseller level backup utility to change the path of a local user backup. The path seems to be hard-coded to /home/username/user_backups.

But if you select the ftp option you can specify the path. And nothing prevents you from ftp'ing the backup to the same server that the user is on.
 
Hello,

As floyed mentioned, here is a guide to tell you how:
http://help.directadmin.com/item.php?id=146

Basically, you create multiple cron backups to use ftp for 127.0.0.1.
Point each cront to a different path, and you can have as many backups as you want.

Also, in the Admin Level Backup/Transfer, you can customize the path, without the need for ftp transfering.

John
 
Back
Top