Backup your Linux Server Apps

Share on TwitterSubmit to StumbleUponDigg This
So you have your linux server up and running. A lot of time and effort went into this so lets get it backed up. You don't need to invest in any fancy backup system. A bit of shell script and some use of crontab will do the trick. Here are the two scripts I use...
    Email backup
Create an executable file e.g. mailserver_backup.sh containing the following
cd /
dt=`date +%Y%m%d_%s`
/bin/tar -czf mailserver_$dt.tar.gz etc/postfix etc/dovecot.conf usr/bin/null.sh usr/local/bin/safilter.sh usr/local/bin/backup_mailprogs.sh etc/mail/spamassassin home/mailfilt/.spamassassin var/spool/mail
    Web backup
Create an executable file e.g. web_sql_backup.sh containing the following
cd /
dt=`date +%Y%m%d_%s`
rm -f mysqlall.sql
mysqldump -uroot -ppassword --all-databases > /mysqlall.sql
/bin/tar -czf mailserver_web_sql_$dt.tar.gz etc/httpd var/www/html mysqlall.sql usr/local/bin/backup_web_sql.sh
Now use crontab to schedule the running of the scripts... crontab -e and enter the following See below Sponsored Links

15	3	*	*	*	/usr/local/bin/mailserver_backup.sh
45	3	*	*	*	/usr/local/bin/web_sql_backup.sh
This will backup mail server apps at 3:15am and web backup at 3:45am. I would also suggest you copy the backed up files to other media in case your server completely crumbles.
Share on TwitterSubmit to StumbleUponDigg This