vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Administrative and Maintenance Tools - Cron job for Files Backup (attachments, avatars, etc.) (https://vborg.vbsupport.ru/showthread.php?t=172630)

Jase2 04-28-2008 08:51 PM

I've now fixed this, Lynne. Somehow, my HTML Editor decided it wanted to play up -- don't know what was wrong, as it was formatting correctly on my computer. Oh well, at least it's fixed now.

Thanks for this, anyway!

nerofix 10-27-2008 03:38 PM

Hey Lynne, thanks for sharing this, I'm very interested in this!

I got a question:

I'd like to backup user's profile albums and avatars only.

Could you assist me with this a bit please? At the moment, both folders are located under www.domain.com/useruploads ...

Now, how to modify the php that it just backup the complete useruploads folder with every subfolder and files?
And do I need the complete path /web/mydomain/vbforum/usersuploads or just /useruploads ?

Lynne 10-27-2008 03:44 PM

You need to put the full path in the file, so put in (no quotes, and note the trailing slash which I mentioned you need to have in my notes above) "/web/mydomain/vbforum/usersuploads/"

nerofix 10-27-2008 03:54 PM

Hey thanks a lot for your answer.. does it also save subfolders then? And can I remove not needed variables from the php file, like this:

PHP Code:

<?php


error_reporting
(E_ALL & ~E_NOTICE);

if (!
is_object($vbulletin->db))
{
    exit;
}

        
$backupdate date("Y-m-d");
        
//"Y-m-d-H-i-s" to include time

        
$backupdir1 "/my/path/to/useruploads/";

        
//Absolute path to where the files are located
        //ie.  "/home/sitename/public_html/forums/images/avatars/";

        
$files "*";
        
//What file to backup? Use a * to backup all the files
        //inside the folder entered above.

        
$backupto "/my/path/to/backups/";
        
//Absolute path to where to store the backups
        //Make sure to put this outside your root folder
        //Permissions should be 777
        //ie. "/home/sitename/backups/

        
$fileprefix1 "alluseruploads";

        
//This is the prefix that will be added before the date:
        //bak2006-02-25.tar

        
$tararg "-cf";
        
//Here goes the tar arguments.
        // -cf to archive - tar
        // -cjf to archive and bzip2
        // other notes: 
        // -tf to list the contents later on
        // -xf to extract them all later on

//Call the function
backupsus($backupdate,$backupdir1,$backupto,$fileprefix1,$tararg,$files);

function 
backupsus($backupdate,$backupdir1,$backupto,$fileprefix1,$tararg,$files) {

$backupalluseruploads "cd $backupdir1;
    tar 
$tararg {$fileprefix1}{$backupdate}.tar $files;
    mv 
{$fileprefix1}{$backupdate}.tar $backupto";
    
passthru ("$backupalluseruploads");

}

log_cron_action('Profile, Avatar and Attachment Backup Completed'$nextitem);

?>

Would I run into problems to just have 1 backup variable and 1 prefix variable?

compuminus 02-20-2009 04:29 PM

There's a big mistake in the provided mod php file. Currently, it reads:

Code:

$backupattach = "cd $backupdir2;
        tar $tararg {$fileprefix3}{$backupdate}.tar $files;
        mv {$fileprefix3}{$backupdate}.tar $backupto";
        passthru ("$backupattach");
}

When it should really be:

Code:

$backupattach = "cd $backupdir3;
        tar $tararg {$fileprefix3}{$backupdate}.tar $files;
        mv {$fileprefix3}{$backupdate}.tar $backupto";
        passthru ("$backupattach");
}

Otherwise all attachments will not be backed up! Instead, directory 2 (the profile pictures) are just backed up twice...

Lynne 02-20-2009 07:59 PM

Yikes! Good catch! Updated.

Sunka 06-07-2009 07:21 AM

One question:
Could use this script to backup forum folder itself?
I would like to backup several folders (pictures, attachments, thumbnails), they are all above forum folder (public_html and above) and to backup forum folder too.
Is it possible? I asking because, this script have to be in cron folder, and cron folder is in forum folder.

Lynne 06-07-2009 04:24 PM

I have never tested it to backup my forum folders. You actually don't have to put the cron job in the cron folder, you can put it wherever you want as long as you put the correct path in the Scheduled Task.

R-D 07-04-2009 12:58 AM

Thanks for the script, Lynne!

It works perfect on the smaller backups (avatars, profile pics, album pics, etc.). Didn't like near 300MB of attachments though but that's probably due to PHP limits on my server.

Still highly recommended to anyone else looking to backup their files. :)

Lynne 07-04-2009 02:38 PM

Quote:

Originally Posted by R-D (Post 1842452)
Thanks for the script, Lynne!

It works perfect on the smaller backups (avatars, profile pics, album pics, etc.). Didn't like near 300MB of attachments though but that's probably due to PHP limits on my server.

Still highly recommended to anyone else looking to backup their files. :)

I get a "mysql server not found" error every time I do the backup of my attachments (over 12GB). It's a mysql timeout thing - the script does the backup and then the next step is to input a line in the Scheduled Task log and at that point the connection is no longer open and you get the error. It's no big deal - the attachments *are* backed up - there is just no line in the Scheduled Task log to say the script was run.


All times are GMT. The time now is 03:16 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01211 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete