Pagina 3 di 4 PrimaPrima 1234 UltimaUltima
Risultati da 21 a 30 di 34

Discussione: Backup con VBulletin

  1. #21
    Citazione Originariamente Scritto da mossss
    infine, mentre fai il backup su uno posta "rovineresti" solo il bck il db assolutamente no
    Ah meno male

  2. #22
    vBulletin Lover L'avatar di mossss
    Data Registrazione
    Dec 2004
    Località
    Google Campus
    Età
    43
    Messaggi
    742

    Thumbs up

    una funzione che c'è sempre stata ma ho 'scoperto' solo ora...

    è ottimale per me che ho una flat ma lenta e non posso tenere bloccato il forum per ore.

    in ACP => Importa & Manutenzione => Backup DB selezionate le tabelle che volete backuppare e poi Backup database in un file sul server

    è una cosa interessantissima che mi ha permesso di fare l'intero backup (400MB) in soli 5 min

    e poi me lo scarico tranquillamente quando voglio dal server
    mossss

    OnlyFocus.com
    Discussioni: 9,236, Messaggi: 493,085, Utenti: 2,011
    powered by vBulletin 3.6.0 + vBadvanced CMPS 2.2 + Coppermine Gallery v1.4.8
    Vi prego di NON mandare email/PM per chiedere supporto, usate il forum!!!

  3. #23
    Inattivo L'avatar di jancarlo
    Data Registrazione
    Feb 2005
    Località
    Nord-Est
    Età
    68
    Messaggi
    374
    In vb.org c'è un hack che fa il backup in automatico e decidi tu il giorno e l'ora

    jancarlo

  4. #24
    Borg L'avatar di y2ksw
    Data Registrazione
    Nov 2004
    Località
    Bologna, Italia
    Età
    64
    Messaggi
    9,035
    Al posto del hack è meglio creare un cron (script php) e chiamarlo da vbulletin. Oppure, meglio, chiamare uno script in asincrono dal phpinclude_end:

    Codice PHP:
    session_start();
    if(!
    $_SESSION['cronjob_done'])
    {
        
    ob_start();
        
    $fs fsockopen('www.sito.com'80$errno$errstr5);
        if(
    $fs)
        {
            
    fwrite($fs"GET /cron/cronjobs.php HTTP/1.0\r\n"
                
    "Host: www.sito.com\r\n\r\n");
        }
        
    ob_end_clean();
        
    $_SESSION['cronjob_done'] = TRUE;

    Naturale che lo script chiamato deve essere privo di errori, e non deve andare in loop per nessun motivo!
    Giovanni
    http://www.trimelli.com/

    Per favore non mandatemi PM, ma scrivete sul forum. Vi sarà risposto prima.

  5. #25
    vBulletin Lover L'avatar di mossss
    Data Registrazione
    Dec 2004
    Località
    Google Campus
    Età
    43
    Messaggi
    742
    Giovanni potresti passare tutto il necessario per fare ciò che dici? Sarebbe molto utile...

    grazie
    mossss

    OnlyFocus.com
    Discussioni: 9,236, Messaggi: 493,085, Utenti: 2,011
    powered by vBulletin 3.6.0 + vBadvanced CMPS 2.2 + Coppermine Gallery v1.4.8
    Vi prego di NON mandare email/PM per chiedere supporto, usate il forum!!!

  6. #26
    Borg L'avatar di y2ksw
    Data Registrazione
    Nov 2004
    Località
    Bologna, Italia
    Età
    64
    Messaggi
    9,035

    Lightbulb cronjobs.php (1)

    Codice PHP:
    <?php
    /*******************************************************************************
    * (C) Copyright Y2K Software s.a.s. 2005                                       *
    * All Rights Reserved                                                          *
    ********************************************************************************
    * Realtime Cronjobs                                                            *
    * Require to run without error reporting nor locks or messages (blank pages).  *
    * All scripts must reside in the same folder and require to set $cron_ok to    *
    * TRUE if successful.                                                          *
    * The database is already open so there is no need to repeat opening.          *
    * Also cron scripts should not open a session or use common functions or       *
    * variables.                                                                   *
    * Cronjobs should test if $cron_jobs = TRUE, else do nothing.                  *
    *******************************************************************************/
    error_reporting(0);
    ignore_user_abort(TRUE);    // continue script if session quits

    $DEBUG FALSE;
    //$DEBUG = TRUE;
    $cron_jobs TRUE;
    $time_limit 10;      // in seconds, 0 = no limit

    // Functions -------------------------------------------------------------------

    function cron_db_open()
    {
        
    $db 0;
        
    $db_host 'localhost';
        
    $db_name 'database_name';
        
    $db_username 'username';
        
    $db_password 'password';
        
    $db_port 3306;
        
        
    $host $db_host;

        if(
    $db_port && $db_port != 3306)
        {
            
    $host "$db_host:$db_port";
        }

        if(
    mysql_connect($host$db_username$db_password))
        {
            return 
    mysql_select_db($db_name);
        }
    }

    function 
    cron_iif($var$true$false '')
    {
        return 
    $var $true $false;
    }

    function 
    cron_datadump($table)
    {
        
    $result .= "# Dump of `$table`\r\n"
            
    "# Dump DATE: " date("Y-m-d H:i:s") . "\r\n"
            
    "\r\n"
            
    ;
        
    $rss mysql_query("SELECT * FROM $table");
        
    $num_fields = @mysql_num_fields($rss);

        while(
    $rs mysql_fetch_row($rss))
        {
            
    $result .= "INSERT INTO `$table` VALUES (";
            for(
    $j 0$j $num_fields$j++)
            {
                
    $a addslashes($rs[$j]);
                
    $a ereg_replace("\r""\\r"$a);
                
    $a ereg_replace("\n""\\n"$a);
                
    $result .= "'$a'";
                
    $result .= $j $num_fields ', ' '';
            }
            
    $result .= ");\r\n";
        }
        return 
    $result "\r\n\r\n";
    }

    // BEGIN OF SCRIPT =============================================================

    // Open database ---------------------------------------------------------------
    while(cron_db_open())     // pseudo-loop
    {
        
    // Check if cronjob is running ---------------------------------------------
        
    $SQL "UPDATE service "
            
    "SET VALUE='1' "
            
    "WHERE PARAMETER='INCRON' "
            
    "AND VALUE='0' "
            
    "LIMIT 1"
            
    ;
        if(!
    mysql_query($SQL)) break;
        if(!
    mysql_affected_rows()) break;
        
        
    // Open cronjob table ------------------------------------------------------
        
    $SQL "SELECT ID, SCRIPT "
            
    "FROM cron "
            
    "WHERE ENABLED=1 "
            
    "AND DATE<=NOW() "
            
    "AND SECS>0 "
            
    "ORDER BY EXECORDER"
            
    ;
        if(!
    $rss_cron mysql_query($SQL)) break;

        
    // Cycle cronjobs ------------------------------------------------------
        
    while($rs_cron mysql_fetch_row($rss_cron))
        {
            
    // Set max execution time ------------------------------------------
            
    set_time_limit($time_limit);
            
            
    $cron_ok FALSE;
            
    $lastops 0;

            if(
    $DEBUG)
            {
                echo 
    $rs_cron[1];
            }
            
            
    // Check for cronjob file ------------------------------------------
            
    if(file_exists($rs_cron[1]))
            {
                require_once(
    $rs_cron[1]);
                if(
    $cron_ok)
                {
                    
    // Update null dates ---------------------------------------
                    
    $SQL "UPDATE cron "
                        
    "SET DATE=CURDATE(), "
                        
    "LASTOPS = $lastops "
                        
    "WHERE ID=$rs_cron[0] "
                        
    "AND DATE='0000-00-00 00:00:00' "
                        
    "LIMIT 1"
                        
    ;
                    if(
    mysql_query($SQL))
                    {
                        
    // Update cycle until DATE>NOW() ---------------------------
                        
    $SQL "UPDATE cron "
                            
    "SET DATE=DATE_ADD(DATE, INTERVAL SECS SECOND), "
                            
    "LASTOPS = $lastops "
                            
    "WHERE ID=$rs_cron[0] "
                            
    "AND DATE<=NOW() "
                            
    "LIMIT 1"
                            
    ;
                        
    // Repeat until updated ------------------------------------
                        
    do
                        {
                            
    mysql_query($SQL);
                        } while(
    mysql_affected_rows() > 0);
                    }
                }
            }

            if(
    $DEBUG)
            {
                echo 
    $cron_ok ' <b>OK</b><BR>' " <b>Error</b><BR>";
            }
        }
        
        
    // Enable cronjobs again ---------------------------------------------------
        
    $SQL "UPDATE service "
            
    "SET VALUE='0' "
            
    "WHERE PARAMETER='INCRON' "
            
    "LIMIT 1"
            
    ;
        
    mysql_query($SQL);
        break;
    }

    unset(
    $cron_jobs);

    // END OF SCRIPT ===============================================================
    ?>
    Giovanni
    http://www.trimelli.com/

    Per favore non mandatemi PM, ma scrivete sul forum. Vi sarà risposto prima.

  7. #27
    Borg L'avatar di y2ksw
    Data Registrazione
    Nov 2004
    Località
    Bologna, Italia
    Età
    64
    Messaggi
    9,035

    cron_bkp_forum.php (2)

    Codice PHP:
    <?php
    /*******************************************************************************
    * (C) Copyright Y2K Software s.a.s. 2005                                     *
    * All Rights Reserved                                                         *
    ********************************************************************************
    * Realtime Cronjob: Database backup for vb3_* tables (forum)                 *
    *******************************************************************************/
     
    // BEGIN OF SCRIPT =============================================================
     
    while($cron_jobs)     // pseudo-loop
    {
        
    // Backup ------------------------------------------------------------------
        
    $vbfiledata '';
        if(!
    $rss mysql_list_tables('database_name')) break;
        while(
    $rs mysql_fetch_row($rss))
        {
            if(
    substr($rs[0], 04) == 'vb3_')
            {
                
    $vbfiledata .= cron_datadump($rs[0]);
                
    $lastops++;
            }
        }
        
    mysql_free_result($rss);
        
    /*
        $message = "This is a backup created by a script on your site.\r\n"
            . "The location of the script is " . __FILE__ . ".\r\n"
            ;
        if($vbfiledata)
        {
            $filename = date("Y-m-d_H-i-s") . "_vb3_database_name.sql.gz";
            $vbfiledata = gzencode($vbfiledata, 9);
            $mail = new xmail();
            $mail->from = $from_email;
            $mail->to = 'admin@domain.com';
            $mail->subject = "Forums database backup";
            $mail->xpriority = 1;
            $mail->body = $message;
            $mail->add_attachment($vbfiledata, $filename, 'application/x-zip-compressed', 'base64');
            $vbfiledata = '';
            $mail->send();
        }
        */
        
    $cron_ok TRUE;
        break;
    }
     
    // END OF SCRIPT ===============================================================
    ?>
    Nota: Il mailer non voglio mettere qui, quindi inventatevi qualcosa , o pagate
    Giovanni
    http://www.trimelli.com/

    Per favore non mandatemi PM, ma scrivete sul forum. Vi sarà risposto prima.

  8. #28
    Borg L'avatar di y2ksw
    Data Registrazione
    Nov 2004
    Località
    Bologna, Italia
    Età
    64
    Messaggi
    9,035

    Tabella cron (non vbulletin!) (3)

    Codice PHP:
    # --------------------------------------------------------
    #
    # Struttura della tabella `cron`
    #
    DROP TABLE IF EXISTS `cron`;
    CREATE TABLE `cron` (
    `
    IDint(11NOT NULL auto_increment,
    `
    ENABLEDtinyint(1NOT NULL default '0',
    `
    DATEdatetime NOT NULL default '0000-00-00 00:00:00',
    `
    SECSint(11NOT NULL default '3600',
    `
    DESCRIPTIONvarchar(255NOT NULL default '',
    `
    SCRIPTvarchar(255NOT NULL default '',
    `
    EXECORDERint(11NOT NULL default '0',
    `
    LASTOPSint(11NOT NULL default '0',
    PRIMARY KEY (`ID`)
    TYPE=MyISAM
    Giovanni
    http://www.trimelli.com/

    Per favore non mandatemi PM, ma scrivete sul forum. Vi sarà risposto prima.

  9. #29
    Borg L'avatar di y2ksw
    Data Registrazione
    Nov 2004
    Località
    Bologna, Italia
    Età
    64
    Messaggi
    9,035
    Eccovi il plugin (anziché hack) al vbulletin, e/o altre applicazioni php. Il tutto funziona alla meraviglia, se il safe-mode è OFF. Se invece è attivo, il timeout viene ignorato, e quindi bisogna accertarsi che il backup esegue a un'ora che è meno battuta, ma che vi sia comunque qualcuno.

    Lo script esegue nel background, quindi l'utente non nota alcuna differenza.

    Attenzione però: Se uno degli script va in loop, perché non vi sia alcun timeout + uno o più errori di programmazione, si consumano tutte le risorse del server, e l'unico modo per uscirci è riavviarlo. Per utenti che non hanno un proprio server, un loop del genere può significare una violazione del contratto all'ISP e si rischia un'ammonizione severa, se non addirittura la chiusura dell'account.

    Il timeout va impostato a un valore in cui si è sicuri che il backup vada a buon termine. 10 secondi è buono per un database fino a 5 MB su un server veloce, dove lo zip prende il tempo maggiore.

    Consiglio inoltre di usare il file system per gli allegati ed avatar, per ridurre le dimensioni.

    Il mailer non è allegato qui, perché mi ci voleva troppo tempo per farlo, in modo che funzioni bene e (quasi) ovunque (php 4.3.10+), e di conseguenza è soltanto in vendita (ca. 50 euretti fatturabili). L'idea ho copiata, ma il codice è tutto mio, perché, come sappiamo tutti, gli esempi freeware non funzionano praticamente mai...
    Giovanni
    http://www.trimelli.com/

    Per favore non mandatemi PM, ma scrivete sul forum. Vi sarà risposto prima.

  10. #30
    vBulletin Lover L'avatar di mossss
    Data Registrazione
    Dec 2004
    Località
    Google Campus
    Età
    43
    Messaggi
    742
    grande giovanni...

    ma che serve sto mailer?

    il mio db è su aruba e pesa circa 220MB, a quanti secondi lo dovrei impostare?
    mossss

    OnlyFocus.com
    Discussioni: 9,236, Messaggi: 493,085, Utenti: 2,011
    powered by vBulletin 3.6.0 + vBadvanced CMPS 2.2 + Coppermine Gallery v1.4.8
    Vi prego di NON mandare email/PM per chiedere supporto, usate il forum!!!

Pagina 3 di 4 PrimaPrima 1234 UltimaUltima

Discussioni Simili

  1. vBulletin 3.5.4
    Di mossss nel forum Annunci & News
    Risposte: 2
    Ultimo Messaggio: 27-03-2006, 20:28
  2. vBulletin 3.0.13
    Di mossss nel forum Annunci & News
    Risposte: 2
    Ultimo Messaggio: 27-03-2006, 20:12
  3. vBulletin 3.0.x Backup con VBulletin
    Di DooM3 nel forum VBulletin 3
    Risposte: 33
    Ultimo Messaggio: 12-11-2005, 14:56
  4. Rilasciata vBulletin 3.5.0 'GOLD'
    Di mossss nel forum Annunci & News
    Risposte: 1
    Ultimo Messaggio: 23-10-2005, 16:10
  5. Vbulletin 3.5 beta 3 !!!
    Di Sergio nel forum Annunci & News
    Risposte: 0
    Ultimo Messaggio: 08-07-2005, 15:32

Tag per Questa Discussione

Segnalibri

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  •