Wednesday, October 22, 2014

Amazon Glacier Backup tools on your server | cPanel, Virtualmin, Directadmin, ...

Amazon Glacier is a cost-effective way to store your backup data.
Recently I set up a cPanel server for weekly database backups on glacier. Here are the steps:

First, install glacier-cmd:

yum install git python
cd /usr/src
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
# For cpanel:
ln -s /usr/local/cpanel/3rdparty/bin/git /usr/bin/git
#
git clone https://github.com/uskudnik/amazon-glacier-cmd-interface
cd amazon-glacier-cmd-interface
python setup.py install

 
Open ~/.glacier-cmd and enter your credential details:

[aws]
access_key=YOUR_ACCESS_KEY
secret_key=YOUR_SECRET_KEY

[glacier]
region=us-west-1
bookkeeping=false
bookkeeping-domain-name=backups
logfile=~/.glacier-cmd.log
loglevel=INFO
output=print





Now you can use the following simple script and cronjob to set a weekly backup:
/script/backup:

#!/bin/sh
NOW=$(date +"%d-%m-%Y")
rm -fr /home/backup-tmp
mkdir /home/backup-tmp
mysqldump -A > /home/backup-tmp/backup-all-db-$NOW.sql
gzip /home/backup-tmp/backup-all-db-$NOW.sql
glacier-cmd upload --description "$NOW Backup" VAULT_NAME /home/backup-tmp/backup-all-db-$NOW.sql.gz



Cronjob:

5 8 * * 6       /script/backup







No comments:

Post a Comment

How to disable Debian 12 sleep on production servers

 Debian 12 has power saver enabled by default which causes your server to go to sleep if there is no mouse / keyboard interaction. To resolv...