Since I’ve been doing server administration for some pretty big websites over the past year or so, I’ve had to come up with some fairly unique backup solutions. I’ve found the best way involves either mounting a backup drive via NFS, or backing up to a secondary hard drive.
I’m currently working on cleaning up the set of scripts I’ve modified & written to release to the public. They’re fairly short, and more a series of commands than anything else at this point. If I get the ambition, I’ll add more error checking into the scripts before I post them here.
Eventually I’ll also post a LAMP install script for RedHat based systems. The script removes the base RPMs for PHP, Apache, and MySQL, then downloads and compiles the latest versions from the various websites (except for MySQL, which is installed via RPM). This script needs a LOT more work before it’s complete, as it really is just a series of commands at this point. The LAMP install script will also secure a server, and install Webmin if desired.
In the meantime, here’s a quick and dirty backup script for to do incremental backups via ssh with rsync:
#!/bin/bash ## Rsync File Backup Script by DaiTengu. ## Version 0.1 ## License pending ## ## This script PULLS backups. It should be run on the server ##storing the backups. ## ## You need to create a ssh keypair between the two servers ## for this to work properly! ## ## Variables go here! # Exclude line # (Must be in the format of: " --exclude file1 --exclude dir1" etc.) exclude=" --exclude aquota.user --exclude vpopmail" # rsync switches (see rsync --help or man rsync for more information) rswitch=" --archive --delete --compress -vv --rsh=ssh" # Local backup directory (where backups will be stored) backupdir=/backups # Remote server (The server containing the original files) host=127.0.0.1 # Remote username (Make sure this user has access to read the files, and that # you've set up a ssh keypair for it! If you're using archive mode, root # would be best, here.) user=root # Remote backup directory remotedir=/home ###### # You don't need to edit anything down here... really! ###### rsync $rswitch $exclude $user@$host:$remotedir/ $backupdir
Like I said, it’s quick and dirty. I’ll add more to it later, but I just wanted to get it out there. ![]()




















No comment yet