Version 1.4 updated: 2010-01-25 compatible with ISPCP 1.03
First, we should make sql table for define, how long do you want to keep
backups / domain.
Code:
CREATE TABLE IF NOT EXISTS `domain_backup` (
`id` int(5) NOT NULL auto_increment,
`domain_name` varchar(200) character set utf8 collate utf8_unicode_ci NOT NULL,
`site_backup_days` smallint(2) NOT NULL,
`db_backup_days` smallint(2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Next, please make this file:
/var/www/ispcp/engine/
backup/archive_
backups
check in the Attachment! or this txt:
http://yoursitehosting.net/archive_backups.txt
Make exec:
Code:
chmod +x /var/www/ispcp/engine/backup/archive_backups
Go and add this new line to crontab (/etc/cron.d/ispcp):
Code:
0 4 * * * root /var/www/ispcp/engine/backup/archive_backups > /dev/null
Please do a
backup first about these files:
/var/www/ispcp/gui/reseller/domain_edit.php
/var/www/ispcp/gui/themes/omega_original/reseller/domain_edit.tpl
Code:
cp -p /var/www/ispcp/gui/themes/omega_original/reseller/domain_edit.tpl /var/www/ispcp/gui/themes/omega_original/reseller/domain_edit.tpl_backup
cp -p /var/www/ispcp/gui/reseller/domain_edit.php /var/www/ispcp/gui/reseller/domain_edit.php_backup
And if you never edited that files, then please replace them with the attachment files or these txts:
http://yoursitehosting.net/domain_edit_php.txt
http://yoursitehosting.net/domain_edit.tpl.txt
I created an instruction for manually edit these files if you don't want to repleace them:
http://yoursitehosting.net/domain_edit.p...y_line.txt
http://yoursitehosting.net/domain_edit.t...y_line.txt
And if you want custom days of keep
backups per domain, then just update it at reseller level via edit domain, also you can set if you want to keep your site and/or your database
backups:
If you want to turn off the this new directory (/var/www/virtual/$domain_name/archive_
backups) from quota, then please edit this file:
/var/www/ispcp/engine/quota/ispcp-dsk-quota (line
118):
Code:
my $s = `$cmd_du --exclude="backups/$domain_name-*.lzma" --exclude="backups/$domain_name-*.bz2" --exclude="backups/$domain_name-*.gz" --exclude="backups/*.sql.lzma" --exclude="backups/*.sql.bz2" --exclude="backups/*.sql.gz" --exclude="logs/*.log" -s -B1 $main::cfg{APACHE_WWW_DIR}/$domain_name`;
change to:
Code:
my $s = `$cmd_du --exclude="archive_backups" --exclude="backups/$domain_name-*.lzma" --exclude="backups/$domain_name-*.bz2" --exclude="backups/$domain_name-*.gz" --exclude="backups/*.sql.lzma" --exclude="backups/*.sql.bz2" --exclude="backups/*.sql.gz" --exclude="logs/*.log" -s -B1 $main::cfg{APACHE_WWW_DIR}/$domain_name`;
And we should edit the
backup script too (/var/www/ispcp/engine/
backup/ispcp-
backup-all):
find this line:
269
Code:
$backup_cmd = "$cmd_tar --create --directory=$dmn_dir --$zip --file=$dmn_dir/$backup_filename --exclude=logs --exclude=phptmp --exclude=backups --exclude=$backup_filename --exclude=$backup_filename.log . 2> $dmn_dir/$backup_filename.log";
and change to:
Code:
$backup_cmd = "$cmd_tar --create --directory=$dmn_dir --$zip --file=$dmn_dir/$backup_filename --exclude=logs --exclude=phptmp --exclude=backups --exclude=archive_backups --exclude=$backup_filename --exclude=$backup_filename.log . 2> $dmn_dir/$backup_filename.log";
If you have any question, just pm me
Script will create the directories (if not exist) and will create an entry to database too.
ps:at attachments, domain_edit.tpl.txt needed to rename to domain_edit.tpl
and also be carefully, if you will use online (txt) versions.
site
backups renamed to archive_
backups due to the script not only contain the site
backups.
Thanks all to Kami and all other members, who help me.