This is a really simply and of course my first script to copy firewall backups to a remote server and rotate the backups.
– The script generate log files and list the files that were modified (copied or deleted).
– The first part of the script checks on the remote server the old backups and deletes the files older than 32 days.
– The second part of the script checks on the local system the new backups and copies the files younger then 3 hours.
To understand the operation of the commands and the timing I made one more post here.
#!/bin/sh################################################################################ # # Define the backup folders (Local and Remote Folders)# Local FolderFW_BACKUPDIR_LOCAL=/var/log/backup/ # Remote Folder FW_BACKUPDIR_REMOTE=/data/backup/firewall ################################################################################ LOGDIR=/var/log LOGFILE=`basename $0 | awk -F. ‘{print $1}’`.log exec 1>>$LOGDIR/$LOGFILE ################################################################################ echo “########## `basename $0` started on `uname -n`: `date` ##########” ################################################################################ # Firewall Backups # List the affected files ################################################################################ # Firewall Backups # List the affected files ################################################################################ echo “########## `basename $0` completed on `uname -n`: `date` ########” |
Posted on March 16, 2012
0