ABOUT bash-cloud-backup ======================= bash-cloud-backup is a set of bash scripts, which can be used to automate local and cloud backup in Linux/Unix machines. (some of these can be run in Windows machines using msys http://www.mingw.org/wiki/msys). LOCAL FILESYSTEM BACKUP bash-cloud-backup keeps rotating compressed tarballs or certain directories or files or MySQL databases. tar and gzip are being used. Backup files are stored in specified directories and are deleted rotating (7 days default). AMAZON S3 SYNC After local filesystem backup has been completed, the backup directory is synchronized with Amazon S3, using s3cmd sync. INCREMENTAL ENCRYPTED BACKUPS WITH DUPLICITY (AMAZON S3) After local filesystem backup has been completed, the backup directory is uploaded to Amazon S3, using duplicity. Attention: No GPG key is used. Just the PASSPHRASE protection. COPYRIGHT: Christos Pontikis (pontikis@gmail.com) - MediSign SA (http://www.medisign.gr) LICENSE: GNU General Public License (http://www.gnu.org/copyleft/gpl.html) SCRIPTS included in bash-cloud-backup ===================================== bkp_all.sh: the main script conf/initialize.sh: main configuration script conf/db-mysql: mysql databases to backup conf/sites: web server directories to backup conf/scripts: scripts to backup conf/conf-files: configuration files to backup conf/svn-repos: svn repos to backup bkp_mysql.sh: Performs backup of selected mysql databases (in conf/db-mysql). bkp_www.sh: Performs backup of selected web server directoties (in conf/sites). bkp_conf.sh: Rerforms backup of selected system configuration files (in conf/conf-files). bkp_scripts.sh: Performs backup of selected scripts (in conf/scripts). bkp_svn.sh: Performs backup of selected SVN repos (in conf/svn-repos). bkp_otrs.sh: Performs backup of OTRS support ticketing system. s3-plain-sync.sh: backup directory is synchronized with Amazon S3, using s3cmd sync s3-plain-sync-custom.sh: custom sync using s3cmd sync s3-dup-backup.sh: backup directory is uploaded to Amazon S3, using duplicity s3-dup-restore.sh: simple tool to restore a file from duplicity archives s3-dup-list.sh: simple tool to list current files in duplicity archives LOGS ==== bash-cloud-backup is keeping logs in log directory. You should take care for logfile rotation. EXTERNAL SOFTWARE ================= duplicity http://duplicity.nongnu.org/ (for Debian: apt-get install duplicity pytho-boto) s3tools http://s3tools.org/ (for Debian: apt-get install s3cmd) (start with s3cmd --configure - more details at http://www.saltycrane.com/blog/2010/02/s3cmd-notes/) AMAZON S3 ACCOUNT ================= For cloud backup, an Amazon S3 account is needed (http://aws.amazon.com/s3/) SETUP USING GIT (recommended) ============================ # setup (using git) cd /root/scripts git clone git://github.com/pontikis/bash-cloud-backup.git # get updates (using git) cd /root/scripts git fetch git merge origin SETUP by download ================= If git is not available, download the source: wget https://github.com/pontikis/bash-cloud-backup/zipball/master CONFIGURATION ============= IMPORTANT SECURITY ISSUE: Ensure that all executable (*.sh) and directories are mod 700 and text files 600: cd /root/scripts chown -R root:root bash-cloud-backup chmod 700 bash-cloud-backup chmod 700 bash-cloud-backup/conf.default chmod 600 bash-cloud-backup/conf.default/* chmod -R 700 bash-cloud-backup/*.sh chmod -R 700 bash-cloud-backup/conf.default/*.sh copy -R conf.default conf and edit conf/initialize.sh (parameters and Amazon S3 credentials) copy bkp_all.default.sh to bkp_all.sh and edit it (uncomment procedures to be executed) copy s3-plain-custom.default.sh to s3-plain-custom.sh and edit it (optional) RUN === To perform backup, call bkp_all.sh (you may use CRON for automation). Each one from bkp_* or s3_* can run as stand-alone script. CRON AUTOMATION =============== su -l root crontab -e 0 1 * * * /usr/bin/nice -n19 /root/scripts/bash-cloud-backup/bkp_all.sh | mail -s "Daily backup" admin@yourdomain.com #Daily Backup (every night at 01:00)
thenetexperts/bash-cloud-backup
bash-cloud-backup is a set of bash scripts, which can be used to automate local and cloud backup in Linux/Unix machines.
Shell