Current time: 04-19-2024, 04:07 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
backup problems?
Author Message
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #21
RE: backup problems?
If you are using 1.0.4, then there's a problem with your database (it contains subdomains and/or aliases that don't point to any parent domain). See this post, and delete the affected orphan subdomains.
(This post was last modified: 03-21-2010 07:56 PM by kilburn.)
03-21-2010 07:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
rauschr Offline
Junior Member
*

Posts: 121
Joined: May 2008
Reputation: 0
Post: #22
RE: backup problems?
Thx.
It was for Use of uninitialized value in concatenation (.) or string at /var/www/ispcp/engine/traffic/ispcp-vrl-traff line 279.

But
it is left:
Use of uninitialized value in hash element at /var/www/ispcp/engine/traffic/ispcp-vrl-traff line 339.
Use of uninitialized value in hash element at /var/www/ispcp/engine/traffic/ispcp-vrl-traff line 477.
Use of uninitialized value in hash element at /var/www/ispcp/engine/traffic/ispcp-vrl-traff line 672.
(This post was last modified: 03-23-2010 06:53 AM by rauschr.)
03-22-2010 06:14 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zothos Offline
Release Manager
*****
Dev Team

Posts: 1,262
Joined: Feb 2007
Reputation: 10
Post: #23
RE: backup problems?
is there a ticket about this?
03-23-2010 08:44 AM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #24
RE: backup problems?
@Zothos: no need for tickets. These subdomains/aliases were left orphaned by old bugs in 1.0.0 that have been fixed a long time ago.

@rauschr: please stop subverting this topic (as your comments have nothing to do with backup problems) and do not double post. Thanks.
(This post was last modified: 03-23-2010 09:42 AM by kilburn.)
03-23-2010 09:35 AM
Visit this user's website Find all posts by this user Quote this message in a reply
rauschr Offline
Junior Member
*

Posts: 121
Joined: May 2008
Reputation: 0
Post: #25
RE: backup problems?
would be a problem in which I ask your help

1.0.4 and Debian Etch 64

it is a mail:
Quote:A critical error just was encountered while executing function backup_sql() in /var/www/ispcp/engine/backup/ispcp-backup-all

Error encountered was:

========================================================================
Domain bringasruhak.hu: ERROR: Failed to backup database 71_bringas!
========================================================================

it is a error log:
Quote:'71_bringas' >'/var/www/virtual/bringasruhak.hu/backups/71_bringas.sql'' returned '2' status !
03-24-2010 12:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #26
RE: backup problems?
I suspect that this database is in a corrupted state. Try to manually backup it using "mysqldump -uroot -p 71_bringas > /tmp/71_bringas.sql" and see if it throws any meaningful error or it completes succesfully... If it fails, try to repair the database and it's tables through phpMyAdmin.
03-24-2010 01:02 AM
Visit this user's website Find all posts by this user Quote this message in a reply
rauschr Offline
Junior Member
*

Posts: 121
Joined: May 2008
Reputation: 0
Post: #27
RE: backup problems?
Thanks a lot.
Big Grin
(This post was last modified: 03-25-2010 08:57 AM by rauschr.)
03-24-2010 06:42 AM
Visit this user's website Find all posts by this user Quote this message in a reply
peteraugusts Offline
Banned

Posts: 3
Joined: Mar 2010
Post: #28
RE: backup problems?
Well can anyone suggest me ?. I have problem with my server backup. Windows automated backup has been failing on 2 separate servers. I have set up a daily backup on one and it will run once but then never again. I set up weekly backups on another server and they never run. This was working great about 2 months ago but after running out of drive space and resetting the backup schedules I have never been able to get it automated again. So right now i am doing backup manually. But i really need to get back to the automation. Any ideas why it would runonce but not repeatedly ? Is the backup in server 2k3 bugged? Should I look to other software? If anyone knows about this than please suggest me the best.
04-02-2010 04:21 PM
Find all posts by this user Quote this message in a reply
romantik Offline
Junior Member
*

Posts: 54
Joined: Mar 2009
Reputation: 0
Post: #29
RE: backup problems?
hi all,

I would like ask for your help.

I'm receiving this error message:

Quote:Hey There,

I'm the automatic email sent by on your domain.tld (87.229.x.x) server.

A critical error just was encountered while executing function backup_all_engine() in /var/www/ispcp/engine/backup/ispcp-backup-all

Error encountered was:

========================================================================
Domain google-positions.com: ERROR: tar returned exit status 0, have a look in /var/www/virtual/.log
========================================================================

ERROR: tar returned exit status 0, have a look in /var/www/virtual/.log

1. Witch log?
2. I don't want tar anything. I was [/align]switch from bzip2 to rsync..

Yesterday I made a few changes: http://isp-control.net/forum/thread-5156.html

Backup are created, bud i have a lots of automatic error email (see above).

Any idea?

ispcp-backup-all file:

Code:
#!/usr/bin/perl

# ispCP ─ÄÔÇ░ (OMEGA) a Virtual Hosting Control Panel
# Copyright (C) 2001-2006 by moleSoftware GmbH - http://www.molesoftware.com
# Copyright (C) 2006-2010 by isp Control Panel - http://ispcp.net
#
# Version: $Id: ispcp-backup-all 2511 2010-01-11 08:08:16Z joximu $
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is "VHCS - Virtual Hosting Control System".
#
# The Initial Developer of the Original Code is moleSoftware GmbH.
# Portions created by Initial Developer are Copyright (C) 2001-2006
# by moleSoftware GmbH. All Rights Reserved.
# Portions created by the ispCP Team are Copyright (C) 2006-2010 by
# isp Control Panel. All Rights Reserved.
#
# The ispCP ─ÄÔÇ░ Home Page is:
#
#    http://isp-control.net
#

use FindBin;
use lib "$FindBin::Bin/..";
require 'ispcp_common_code.pl';

use strict;
use warnings;

our $backup_lock_file = "/tmp/ispcp-backup-all.lock";

sub lock_backup_all_system {

    push_el(\@main::el, 'lock_backup_all_system()', 'Starting...');

    if ($main::cfg{'BACKUP_DOMAINS'} ne 'yes') {

        push_el(\@main::el, 'lock_backup_all_system()', 'NOTICE: domain backups are disabled');
        return 2;
    }

    if (-e $backup_lock_file) {

        push_el(\@main::el, 'lock_backup_all_system()', 'ERROR: backup request engine already locked!');
        return 1;

    }

    my $touch_cmd = "$main::cfg{'CMD_TOUCH'} $backup_lock_file";

    my $rs = sys_command($touch_cmd);
    return 1 if ($rs != 0);

    push_el(\@main::el, 'lock_backup_all_system()', 'Ending...');

    return 0;
}


sub unlock_backup_all_system {

    push_el(\@main::el, 'unlock_backup_all_system()', 'Starting...');

    my $rs = del_file($backup_lock_file);
    return $rs if ($rs != 0);

    push_el(\@main::el, 'unlock_backup_all_system()', 'Ending...');

    return 0;

}


sub backup_all_start_up {

    my ($rs, $rdata) = (undef, undef);

    push_el(\@main::el, 'backup_all_start_up()', 'Starting...');

    $rs = lock_backup_all_system();
    return $rs if ($rs != 0);

    # config check;

    $rs = get_conf();
    return $rs if ($rs != 0);

    push_el(\@main::el, 'backup_all_start_up()', 'Ending...');

    return 0;

}


sub backup_all_shut_down {


    my $rs = undef;

    push_el(\@main::el, 'backup_all_shut_down()', 'Starting...');

    $rs = unlock_backup_all_system();
    return $rs if ($rs != 0);

    push_el(\@main::el, 'backup_all_shut_down()', 'Ending...');
    return 0;

}


sub err_exit {

    my $el_data = pop_el(\@main::el);

    $main::el_sep = "\t#\t";

    my ($sub_name, $msg) = split(/$main::el_sep/, $el_data);

    print STDERR "$msg\n";

    unlock_backup_all_system($backup_lock_file);
    exit 1;

}

sub backup_sql {

    push_el(\@main::el, 'backup_sql()', 'Starting...');

    my ($dmn_id, $dmn_name, $domain_uid, $domain_gid) = @_;
    my $zip = $main::cfg{'ZIP'};
    my ($rs, $rdata, $sql) = (undef, undef, undef);

    my $dmn_backup_dir = $main::cfg{'APACHE_WWW_DIR'}."/$dmn_name/backups";

    $sql = "SELECT sqld_id, sqld_name FROM sql_database WHERE domain_id=$dmn_id";
    ($rs, $rdata) = doSQL($sql);

    foreach (@$rdata) {

        my $db_id = @$_[0];
        my $db_name = @$_[1];
        my $db_backup_file = "$dmn_backup_dir/$db_name.sql";
        my ($db_filename, $db_compresscmd) = (undef, undef);

        my $db_backupcmd = "$main::cfg{'CMD_MYSQLDUMP'} --add-drop-table --allow-keywords --quote-names -h'$main::cfg{'DATABASE_HOST'}' -u'$main::cfg{'DATABASE_USER'}' -p'".decrypt_db_password($main::cfg{'DATABASE_PASSWORD'})."' '$db_name' >'$db_backup_file'";

        if ($zip eq "bzip2") {
            $db_filename = "$db_backup_file.bz2";
            $db_compresscmd = "$main::cfg{'CMD_BZIP'} --force '$db_backup_file'";
        } elsif ($zip eq "gzip"  || $zip eq "rsync") {
                        $db_filename = "$db_backup_file.gz";
                        $db_compresscmd = "$main::cfg{'CMD_GZIP'} --force '$db_backup_file'";
        } elsif ($zip eq "lzma") {
            $db_filename = "$db_backup_file.lzma";
            $db_compresscmd = "$main::cfg{'CMD_LZMA'} --force '$db_backup_file'";
        } else {
            push_el(\@main::el, 'backup_sql()', "Domain $dmn_name: Backup algorithm for domain $dmn_name not supported: $zip!");
            send_error_mail('backup_sql()', "Domain $dmn_name: Backup algorithm for domain $dmn_name not supported: $zip!");
            return -1;
        }

        $rs = sys_command($db_backupcmd);
        if( $rs != 0 ){
            push_el(\@main::el, 'backup_sql()', "Domain $dmn_name: ERROR: Failed to backup database $db_name!");
            send_error_mail('backup_sql()', "Domain $dmn_name: ERROR: Failed to backup database $db_name!");
            unlink($db_backup_file);
            return $rs;
        }

        $rs = setfmode("$db_backup_file", $domain_uid, $domain_gid, 0660);
        if( $rs != 0 ){
            push_el(\@main::el, 'backup_sql()', "Domain $dmn_name: ERROR: Can not chmod 0660 uid: $domain_uid gid: $domain_gid file $db_backup_file!");
            send_error_mail('backup_sql()', "Domain $dmn_name: ERROR: Can not chmod 0660 uid: $domain_uid gid: $domain_gid file $db_backup_file!");
            unlink($db_backup_file);
            return $rs;
        }

        $rs = sys_command($db_compresscmd);
        if ($rs != 0){
            push_el(\@main::el, 'backup_sql()', "Domain $dmn_name: ERROR: Error while executing  $db_compresscmd!");
            send_error_mail('backup_sql()', "Domain $dmn_name: ERROR: Error while executing $db_compresscmd!");
            unlink($db_backup_file);
            return $rs;
        }

    }

    push_el(\@main::el, 'backup_sql()', 'Ending...');
    return 0;
}

sub backup_all_engine {

    push_el(\@main::el, 'backup_all_engine()', 'Starting...');

    my ($rs, $rdata, $sql) = (undef, undef, undef);
    my $zip = $main::cfg{'ZIP'};

    $sql = "
        SELECT
            t1.domain_id,
            t1.domain_name,
            t1.domain_status,
            t1.domain_uid,
            t1.domain_gid,
            t1.allowbackup,
            t2.admin_name,
            t2.email
        FROM
            domain AS t1,
            admin AS t2
        WHERE
                t1.domain_status    = 'ok'
            AND    t1.domain_admin_id    = t2.admin_id
            AND     t1.allowbackup        != 'no'
        ORDER BY
            t1.domain_id
    ";

    ($rs, $rdata) = doSQL($sql);
    return $rs if ($rs != 0);

    my $cmd_tar = $main::cfg{'CMD_TAR'};

    my $cmd_rm = $main::cfg{'CMD_RM'};

    my $cmd_mv = $main::cfg{'CMD_MV'};

    my $httpd_uid = $main::cfg{'APACHE_USER'};

    my $httpd_gid = $main::cfg{'APACHE_GROUP'};

    foreach (@$rdata) {

    # DO NOT RETURN, even if backup throws an error, otherwise other domains will not be backuped
    # I DO MEAN IT :)

        my ($dmn_id, $dmn_name, $dmn_status, $domain_uid, $domain_gid, $allowbackup, $admin_name, $admin_email) = (@$_[0], @$_[1], @$_[2], @$_[3], @$_[4], @$_[5], @$_[6], @$_[7]);

        if ($allowbackup eq "full" || $allowbackup eq "dmn" || $allowbackup eq "sql") {

            my $date = get_human_date();
            my $www_dir = $main::cfg{'APACHE_WWW_DIR'};
            my $dmn_dir = $main::cfg{'APACHE_WWW_DIR'}."/$dmn_name";
            my $dmn_backup_dir = $main::cfg{'APACHE_WWW_DIR'}."/$dmn_name/backups";
            my ($backup_filename, $backup_cmd) = (undef, "");

            #
            # User Database Backup
            #

            if (! -d $dmn_backup_dir) {
                $rs = make_dir($dmn_backup_dir, $domain_uid, $domain_gid, 0770);
                return $rs if ($rs != 0);
            }

            if( $zip eq 'bzip2' || $zip eq 'gzip' || $zip eq 'lzma' || $zip eq 'xz') {
                $backup_filename = "$dmn_name-backup-$date.tar.".($zip eq 'bzip2' ? 'bz2' : ($zip eq 'gzip' ? 'gz' : $zip));
                if ($allowbackup eq "full" || $allowbackup eq "dmn") {
                    $backup_cmd = "$cmd_tar --create --directory=$dmn_dir --$zip --file=$www_dir/$backup_filename --exclude=logs --exclude=phptmp --exclude=backups . 2> $www_dir/$backup_filename.log";
                }
                if ( $allowbackup eq "full" || $allowbackup eq "sql" ) {
                    $rs = backup_sql($dmn_id, $dmn_name, $domain_uid, $domain_gid);
                }
                
            } elsif( $zip eq 'rsync') {
            $backup_filename = "";

                                if ($allowbackup eq "full" || $allowbackup eq "dmn") {
            $backup_cmd = "rsync -azv --delete-excluded  --exclude=logs --exclude=phptmp --exclude=backups $dmn_dir $dmn_dir/backups";
                                }
                                if ( $allowbackup eq "full" || $allowbackup eq "sql" ) {
                                        $rs = backup_sql($dmn_id, $dmn_name, $domain_uid, $domain_gid);
                                }
            } else {
                push_el(\@main::el, 'backup_all_engine()', "Backup algorithm not supported: $zip for domain $dmn_name!");
                send_error_mail('backup_all_engine()', "Backup algorithm not supported: $zip for domain $dmn_name!");
            }

            if ( length($backup_cmd) != 0 ) {
                $rs = sys_command($backup_cmd);
                
                if ($zip ne "rsync") {
                if ($rs == 0) { # everything ok

                    $rs = sys_command("$cmd_rm -rf $www_dir/$backup_filename.log");
                    if ($rs != 0){
                        push_el(\@main::el, 'backup_all_engine()', "Domain $dmn_name: Error while executing $cmd_rm -rf $www_dir/$backup_filename.log!");
                        send_error_mail('backup_all_engine()', "Domain $dmn_name: Error while executing $cmd_rm -rf $www_dir/$backup_filename.log!");
                    }

                    $rs = sys_command("$cmd_rm -rf $dmn_backup_dir/$dmn_name-*.tar.*");
                    if ($rs != 0){
                        push_el(\@main::el, 'backup_all_engine()', "Domain $dmn_name: Error while executing $cmd_rm -rf $dmn_backup_dir/$dmn_name-*.tar.*!");
                        send_error_mail('backup_all_engine()', "Domain $dmn_name: Error while executing $cmd_rm -rf $dmn_backup_dir/$dmn_name-*.tar.*!");
                    }

                    $rs = sys_command("$cmd_mv -f $www_dir/$backup_filename $dmn_backup_dir");
                    if ($rs != 0){
                        push_el(\@main::el, 'backup_all_engine()', "Domain $dmn_name: Error while executing $cmd_mv -f $www_dir/$backup_filename $dmn_backup_dir!");
                        send_error_mail('backup_all_engine()', "Domain $dmn_name: Error while executing $cmd_mv -f $www_dir/$backup_filename $dmn_backup_dir!");
                    }

                    $rs = setfmode("$dmn_backup_dir/$backup_filename", $domain_uid, $domain_gid, 0660);
                    if ($rs != 0){
                        push_el(\@main::el, 'backup_all_engine()', "Domain $dmn_name: Error while changing mode to 0660 uid: $domain_uid gid: $domain_gid for $dmn_backup_dir/$backup_filename!");
                        send_error_mail('backup_all_engine()', "Domain $dmn_name: Error while changing mode to 0660 uid: $domain_uid gid: $domain_gid for $dmn_backup_dir/$backup_filename!");
                    }
                }
                } else { # some error occurred

                    push_el(\@main::el, 'backup_all_engine()', "Domain $dmn_name: ERROR: tar returned exit status $rs, have a look in $www_dir/$backup_filename.log");
                    # send mail so we know something went wrong...
                    send_error_mail('backup_all_engine()', "Domain $dmn_name: ERROR: tar returned exit status $rs, have a look in $www_dir/$backup_filename.log");

                    # delete backup file...
                    if ( -e "$www_dir/$backup_filename" ) {
                        $rs = del_file("$www_dir/$backup_filename");
                        if ($rs != 0){
                            push_el(\@main::el, 'backup_all_engine()', "Domain $dmn_name: Error while removing file $www_dir/$backup_filename!");
# we don't need a second mail...            send_error_mail('backup_all_engine()', "Domain $dmn_name: Error while removing file $dmn_dir/$backup_filename!");
                        }
                    }

                }
            }
        } else {
            push_el(\@main::el, 'backup_all_engine()', "Domain $dmn_name: ERROR: the type of backup (*$allowbackup*) is not allowed!");
        }
    }

    push_el(\@main::el, 'backup_all_engine()', 'Ending...');

    return 0;

}

my $rs = undef;
my $proceed = $ARGV[0];

if (!defined($proceed) || $proceed eq '') {

    push_el(\@main::el, 'main()', "ERROR: Missing Input Data! Please provide appropriate command line parameter(s)!");

    err_exit();

}

if ($proceed ne 'yes') {

    push_el(\@main::el, 'main()', "NOTICE: If you want full backup of your domain data, please run this script with 'yes' command line parameter!");

    err_exit();

}

$rs = backup_all_start_up();
err_exit() if ($rs != 0 && $rs != 2);

exit 0 if ($rs == 2); # $rs == 2 when backups are disabled

$rs = backup_all_engine();
err_exit() if ($rs != 0);

$rs = backup_all_shut_down();
err_exit() if ($rs != 0);

exit 0;
(This post was last modified: 08-22-2010 08:33 PM by romantik.)
08-22-2010 08:21 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)