[Feature Request] Additional variables in user_backup_pre|post

websafe

Verified User
Joined
Jun 15, 2010
Messages
103
Location
Opole, PL
It would be great to have a

  • backup_id (Backup ID)

variable available in user_backup_pre.sh and user_backup_post.sh scripts.

Why?

On some machines our weekly backup (Admin Backup -> All Users + All Data)
takes 4-5 days. During these days it happens we have to reboot the
server (so the backup is being aborted), and the only option we have
then is to start the backup again - from the beginning.

My idea was to create a backup_pre.sh script, that will check,
if the current users existing backup is older than - lets say 14 days,
if not I'll `exit 1` so DA will skip to the next user.

And this would be possible, but we have another "Admin backup"
running every day (All users + Selected data -> everything except:
"Domains Directory", "Database Data", "E-Mail Data") which takes ~35
minutes and this complicates things, because we want to have this one
to be done each day - without skipping users.

Another option would be to have a "destination path" variable available,
because the "file" variable contains only the path of the temporary
tarball (in /home/tmp/admin.XXX/). If the final tarball destination path
would be accessible in a variable the script would be able to check this path
and based on the path detect which backup is running, because "All data"
and "Selected data" backups are stored in separate final destinations.

But I think having a backup_id variable available would be more natural.

Related threads:


Related feature:



Update

Another variable, containing the final destination path, would be great too,
because in some cases we don't have a backup ID and we need to detect the
current backup by its final destination directory. For example I'm running
a few backups from cron without having them defined in DA->Admin backups,
because it's not possible to setup there more complicated backup strategies
like non-overlapping daily-weekly-monthly:


Code:
# Daily MySQL backup - each Monday
#
30      1       *       *       1       root    echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fdaily\%2F\%31&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Daily MySQL backup - each Tuesday
#
30      1       *       *       2       root    echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fdaily\%2F\%32&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Daily MySQL backup - each Wednesday
#
30      1       *       *       3       root    echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fdaily\%2F\%33&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Daily MySQL backup - each Thurdsday
#
30      1       *       *       4       root    echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fdaily\%2F\%34&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Daily MySQL backup - each Friday
#
30      1       *       *       5       root    echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fdaily\%2F\%35&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Daily MySQL backup - each Saturday
#
30      1       *       *       6       root    echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fdaily\%2F\%36&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Monthly MySQL backup - The first Sunday
#
30      1       1-7     *       *       root    [ "$(date '+\%u')" == "7" ] && echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fmonthly&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Weekly MySQL backup - The second Sunday
#
30      1       8-14    *       *       root    [ "$(date '+\%u')" == "7" ] && echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fweekly\%2F\%32&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Weekly MySQL backup - The third Sunday
#
30      1       15-21   *       *       root    [ "$(date '+\%u')" == "7" ] && echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fweekly\%2F\%33&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Weekly MySQL backup - The fourth Sunday
#
30      1       22-28   *       *       root    [ "$(date '+\%u')" == "7" ] && echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fweekly\%2F\%34&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue

# Weekly MySQL backup - The fifth Sunday
#
30      1       29-31   *       *       root    [ "$(date '+\%u')" == "7" ] && echo "action=backup&append\%5Fto\%5Fpath=nothing&database\%5Fdata\%5Faware=yes&email\%5Fdata\%5Faware=yes&local\%5Fpath=\%2Fmnt\%2Fbackup\%2Fserver\%2Fs\%39\%2Fdirectadmin\%2Fadmin\%2Dbackup\%2Fselected\%2Ddata\%2Fmysql\%2Fweekly\%2F\%35&option\%30=database&option\%31=database\%5Fdata&owner=admin&skip\%5Fsuspended=yes&type=admin&value=multiple&what=select&when=now&where=local&who=all" >> /usr/local/directadmin/data/task.queue
 
Last edited:
Back
Top