System Backup, delete previous backup

LawsHosting

Verified User
Joined
Sep 13, 2008
Messages
2,418
Location
London UK
We do System Backups externally regularly, although what I'm asking can be done by a bash script (& cron) on the external server, it would be good for the process to delete previous backups (either locally or externally) - will save space!

Thanks
 
How would you suggest doing this externally, since we don't know what the external server is. Would you suggest doing it by ftp? If so, then would you only delete files of exactly the same name? If not, how would you keep track of the filenames to delete?

Jeff
 
How would you suggest doing this externally, since we don't know what the external server is. Would you suggest doing it by ftp? If so, then would you only delete files of exactly the same name? If not, how would you keep track of the filenames to delete?
But the system backups get put in directories (YYYY-MM-DD) every time, so just a RM (local) or a DELE (ftp) would suffice?
 
I didn't catch that System Backup (yes, I should have; it's in your post and the subject :) ). I stopped using it a long time ago because of it's limitations. However my point still stands because as far as I know FTP doesn't have a way to do recursive deletes or wildcard deletes.

Jeff
 
However my point still stands because as far as I know FTP doesn't have a way to do recursive deletes or wildcard deletes.
Even so, there should be a solution to this.

We do reseller backups daily, and they overwrite previous backups - this could be an option.
 
How could they overwrite previous backups if they're written with a specific date in the filename? Or did I misunderstand what you previously wrote?

Jeff
 
How could they overwrite previous backups if they're written with a specific date in the filename? Or did I misunderstand what you previously wrote?

Ok, put it like this:

Give an option not to use dated directories, just let us save/ftp to where we state - but I suppose this won't work either, right?
 
Probably would, but then you'd have to keep track of your backups and where you've put them.

I keep on my backup server a directory called currentbackup which is the ftp home directory. Before the backup is done I run a script on the backup server that does the following:
Code:
rm -f backup7
mv backup6 backup7
mv backup5 backup6
mv backup4 backup5
mv backup3 backup4
mv backup2 backup3
mv currentbackup backup2
Jeff
 
We do System Backups externally regularly, although what I'm asking can be done by a bash script (& cron) on the external server, it would be good for the process to delete previous backups (either locally or externally) - will save space!

Thanks


Peter,

For system backups a 3rd party script is used, which has never had a line re-written by Directadmin. Please correct me if I'm wrong. At least no one feature request of mine related to the script has ever been fulfilled (that does not really matter now).

Anyway here it is /usr/local/sysbk/sysbk (opensourced bash script), so please feel free to update/re-write it to meet your own needs.

It is function rtrans() in /usr/local/sysbk/internals/internals.sysbk

In case you want to store one backup for a weekday, then you might want to try to change this

Code:
# SySBK 1.0 [[email protected]]
#
# NOTE: This file should be edited with word/line wrapping off,
#       if your using pico please start it with the -w switch.
#       (e.g: pico -w filename)

INT_FILE="$INSPATH/internals/internals.sysbk"                   # Path to internals file
DATE=`date +"%m-%d-%y"`                                         # Set current date as a variable
IGNORE="$INSPATH/.ignore"                                       # Path to ignore file [used internaly by sysbk]
IGNORE_STATIC="$INSPATH/.stignore"                              # Path to static ignore file [for omitting sites from backup]
QLOG="$INSPATH/status.log"                                      # Path to sysbk log
TMP_FILE="/tmp/.sysbk$$"                                        # Temporary path for variouse operations
TSTAMP=`date +"%D %H:%M:%S"`                                    # time stamp value for log entries and other misc output
PREFIX="[$TSTAMP]:"                                             # prefix for LOG entries

to

Code:
# SySBK 1.0 [[email protected]]
#
# NOTE: This file should be edited with word/line wrapping off,
#       if your using pico please start it with the -w switch.
#       (e.g: pico -w filename)

INT_FILE="$INSPATH/internals/internals.sysbk"                   # Path to internals file
DATE=`date +"%w"`                                               # Set current date as a variable
IGNORE="$INSPATH/.ignore"                                       # Path to ignore file [used internaly by sysbk]
IGNORE_STATIC="$INSPATH/.stignore"                              # Path to static ignore file [for omitting sites from backup]
QLOG="$INSPATH/status.log"                                      # Path to sysbk log
TMP_FILE="/tmp/.sysbk$$"                                        # Temporary path for variouse operations
TSTAMP=`date +"%D %H:%M:%S"`                                    # time stamp value for log entries and other misc output
PREFIX="[$TSTAMP]:"                                             # prefix for LOG entries


in a file /usr/local/sysbk/internals/conf.internals

Note changes:

Code:
DATE=`date +"%w"`                                               # Set current date as a variable

it would change backups to store in

$MOUNT_POINT/backup/0/
$MOUNT_POINT/backup/1/
$MOUNT_POINT/backup/2/
$MOUNT_POINT/backup/3/
$MOUNT_POINT/backup/4/
$MOUNT_POINT/backup/5/
$MOUNT_POINT/backup/6/

Here $MOUNT_POINT/backup is to be changed in Directadmin interface.

from man pages:

Code:
 %w     day of week (0..6); 0 is Sunday
 
Last edited:
Back
Top