Posts tagged server directory
Cron Server Backup Scripts
Aug 15th
Update: Don’t configure cron.hourly etc. manually. Configure it with crontab.
I use three scripts that completely backup my entire server. Two scripts I place in my cron.hourly folder, and one I use in my cron.daily. For hourly backup I export all my databases, and then transfer them via an automated ssh connection to another computer on my local area network. For Mysql database export I use a wonderful script that I found on sourceforge http://sourceforge.net/projects/automysqlbackup/. It has a couple of configurations, and all is self explanatory when you open the file in a text editor. Once your done editing the file to suit your mysql parameters, and desired backup folder location, just plop the file in your /etc/cron.hourly to have it run every hour. Then you can use ssh to transfer the mysql backup folder to another computer!! Make a simple script as follows:
scp /home/user/mysqlbackup/* user@othercomputerip:mysqlbackup/
Use this format to make an automated script to transfer your mysqlbackup folder to another computer via ssh. As with the mysql export script, when your done with the ssh transfer script just plop it in your /etc/cron.hourly folder for automated hourly operation. I also use a daily backup script to transfer, via ssh, my entire website directory. Since I have about 10 GB on the directory, due to the file repository, the ssh over LAN connection comes in handy due to its relatively high speed. Getting speed around 7.7 Mb/s the entire root server directory is backed up in about 15 minutes. To do this just use the same formatting as the ssh transfer script above, but set the directory to be your root server directory. You can place the script in your /etc/cron.daily folder, or any other for that matter
