Backup to mail, is a bash script to create local backup file and then send it to an e-mail account as attached file.
-
Requires a full functional MTA (smtp) working at localhost
-
It is suggested mail comand (if not, errors goes to STDERR)
apt-get install bsd-mailx
- Requires biabam utility:
apt-get install biabam
- Install backup2mail (you may use git)
cd /usr/local/sbin
wget https://github.com/ysidorito/backup2mail/archive/master.zip
unzip master.zip && rm master.zip
cd backup2mail-master
chmod 750 backup2mail.sh
- Edit backup2mail.sh and configure first VARIABLES to your environment.
TO="[email protected]"
- Create respaldar.txt file wih a file/folder at each line
/etc
/usr/local
/var/www/index.php
- Include into cron.daily task:
ln -s /usr/local/sbin/backup2mail/backup2mail.sh /etc/cron.daily/backup2mail
Ready!
- Avoid local disk usage previous create tgz
- Incluir contenido del respaldo en el texto del e-mail
- Avoid error if $FILELIST do not exists (enables isolated run)
- Error to STDERR if mail command or smtp-local-server not installed
- Define max size to e-mail (perhaps split attached file)
- Ensure work on RedHat family OS too