Very simple backup script

emanuelebruno

Renowned Member
May 1, 2012
143
6
83
Catania
emanuelebruno.it
Hi all, I trying to mix some script-code to build a daily easy-backup system. I have a little server in my house that I use for storage and backup. I have created a CT from Ubuntu 12.04 LTS template (http://download.proxmox.com/appliances/system/ubuntu-12.04-standard_12.04-1_i386.tar.gz) and inside I have copied the pscp program ; I have downloaded "pscp software" from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html and I have compiled it ... if you don't want to compile it, you can download "pscp file" from my website http://emanuelebruno.it/forum/topic.php?id=1261#post-2188 (PS You have to register before downloading)

I have copied "pscp file" in the /root folder, I have chmod 555 and finally I have written a little script called backup.sh in the /root directory that contains the following line-codes:

cd /root
today=`date +%Y`_`date +%m`_`date +%d`-`date +%H`
./pscp -pw password root@192.168.1.100:/var/lib/vz/dump/vzdump-openvz-???-"$today"_??_??.tar.* .

In this example "password" is the password for the proxmox 192.168.1.100 server ip address; this script is launched every hour at the 59th minutes from crontab:

crontab -e
59 00-23 * * * sh /root/backup.sh

This backup is not still complete but I'd like to share with you (It lacks of transfer check, some log, email confirm, backup disk space check, autoremove 30 days old backup, probably some backup could be skipped if it is created after the 59 minutes of the 59th seconds that the scripts is lunched, etc..)

PS I'm not using scp because it asks password; if you don't want to use pscp, you have to create an user account without password and establish the scp trasfer with certificate)
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!