Backups are an essential and very important part of a system administrator’s work. There are many tools out there to make backups for different purposes but I choose to write a script on my own for many reasons.
This is a simple shell script designed and written for a web-, database and mailserver (apache, mysql, postfix) that uses rsync to make incremental and fast backups. I use it on different servers and have extended it over the years.
Key features:
- Incremental backups of the given directories
- Set a unlimited amount of directories to backup
- Keep a defined number of old backups
- MySQL backups (each table in one file, one folder for each database)
- Optional upload of the last backup on an external FTP server (compression can be set)
- Monitoring of free disk space on the backup target hard disk and FTP server
- Mail notification if a limit is reached
The requirements:
- rSync (on the local machine)
- ext3 filesystem (supporting hard links)
- lftp (a command line ftp client)
- ncftpput (to upload backups on an external ftp storage system)
- tar
- mysqldump
Both ftp tools are optional – if you don’t want to upload the last backup to an external ftp server (in addition to the local copy), you can deactivate all ftp commands in the script.
The shell script is well commented and you can set a lot of variables. Read all the comments and understand the code, so you know what it does! It is released to the public under the GPLv3 so it comes without any warranty.
Download: backupScript.sh
Related posts:
- Server Density monitoring Boxed Ice’s monitoring service offers a awesome easy way to trace...
Great script. However, I do not have enough local hd space to use it to backup all the files I want. I want everything to be put on an ftp-server. Could you tell me how to rewrite it so it does not depend on a local directory?