HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=29)
-   -   Another backup solution (http://www.howtoforge.com/forums/showthread.php?t=51908)

ncoc.nl 16th March 2011 14:24

Another FTP backup solution
 
3 Attachment(s)
Hello everyone,

Because of not finding a backup solution that fit my needs i've take some pieces from other scripts added some of my own and rewrite it to this one.

How it works:
The script makes a backup of the MySQL database in separate files (each DB has it own file) every 4 hours by using a cronjob, these files are stored in a local directory.

When finished the DB backup and the ISPconfig (Website) backup are copied to a FTP server, to prevent unneccessary load and bandwidth use the backup of the websites is copied once a day during the night (ISPconfig makes 1 backup at 0:30 so extra copies are not needed)

For this script the backup option in ISPconfig must be set.

Do NOT forget to change the < > values to fit your needs

A little manual is in top of the script.

Ronald

ncoc.nl 23rd March 2011 18:38

1 Attachment(s)
Still work in progress, I did some modifications.

What has changed?
The MySQL backup will now keep 7 day en 3 sunday backups, then the oldest will be deleted in the local backup.
The backup directory structure is changed, it will now create a time directory inside the date directory.
Added echo's for screen output when running the script in screen.

TODO:
  • Purge option on remote FTP server - Delete after 7 days, keep sunday for 3 weeks
  • Purge option on remote FTP server - Delete sunday backup after 22 days
  • Create exclusion "if directory exist"
  • Include ISPconfig and all files needed for a reatore in case of a crash
The script is as/is, it does work but I couldn't test the rotation for the 22 days.

Ronald

giganthost 19th April 2011 21:20

good script
 
Hello,
thanks for this great script.

Please be possible in the script set to be compressed database?

ncoc.nl 20th April 2011 16:30

The dump is done with mysqldump, you can compress the DB dir by using:

cd /var/backup
tar -pczf <your_filename>.tar.gz <your_directory_name>/

If neccessary you can delete the dir. afterwards, it will be created with the next backup.

Ronald

Croydon 13th May 2011 18:36

As I mentioned in a different thread, I would suggest adding the --hex-blob and --quote-names command line options to the mysqldump command.

If you have binary blob columns in your database you might run into trouble restoring it from a dump without hex-blob.

ncoc.nl 23rd June 2011 16:48

Hi everyone,

For those who are interested, i did a complete rewrite of the wdbackup.sh and create 2 backupscripts, 1 for an external (your own?) FTP server and 1 for an internal FTP server (hired from or provided by the server hoster)

Short description:

Using an internal FTP backupserver.
This script will copy the websites backup files at 02.00H, the MySQL databases every 4 hours starting at 02.00H and the ISPconfig website and SQL database at 14.00H and 22:00H to an internal FTP server.
The MySQL backup databases on the local server will be purged every 7 days except the sunday backup, this database will be purged every 4 weeks.

Using an external FTP backupserver.
This script will copy the websites at 02.00H, the MySQL databases every 4 hours starting at 02.00H and the ISPconfig website and SQL database at 14.00H and 22:00H to a external FTP server of your choice. Every MySQL backup is overwritten after 24 hours, the websites backup is overwritten after 2 days. The MySQL backup databases on the local server will be purged every 7 days exept the sunday backup, this database will be purged every 4 weeks.

I've used the article http://www.howtoforge.com/forums/showthread.php?t=52466 which describes a standalone FTP server with a webinterface to setup my own backup solution.


The scripts are located in the first post
More information is in top of both scripts.

Ronald

nokia80 2nd July 2011 16:08

work well alone bakup ISPConfig files does not work.

I use the wrong script?


thanks

ncoc.nl 2nd July 2011 22:40

The script is written for debian etch withISPconfig 3.x, possibly you're using a different distro?

Ronald

nokia80 3rd July 2011 19:14

yes i use debian on the mail log i have this mesage:

ISPconfig: No Backup scheduled.

These are the most recent backup files.


thanks

ncoc.nl 3rd July 2011 19:32

The backup of ISPconfig runs at 14:00H and 22:00H, in the notification e-mail backups which are not scheduled to run are mentioned as: No Backup scheduled.

I've found a little "bug" in the backupscript, the backup of ISPconfig is called twice in the script, when it runs e.g. at 14:00 hours the second part which is scheduled at 22:00 will give the message: No Backup scheduled. (and at 22:00 it will give the same message)

Working on it.

Ronald


All times are GMT +2. The time now is 22:54.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.