vb.org Archive

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

Lynne 03-07-2008 10:00 PM

Cron job for Files Backup (attachments, avatars, etc.)
 
This is a script meant to run as a Scheduled Task to backup your files if you have your attachments, avatars, etc. in the file system. I have been running it for a couple of years now and given it to a few other vb admins and figured I should share it here as my first Mod. I found the basic part of the script somewhere online a couple of years ago and modified it to work with vbulletin.

Installation:
Download the file and modify the variables at the top of the file. The $backupdir should be an absolute path to a folder you wish to backup. Make sure you have a trailing "/" in the path. The $backupto variable is the absolute path to the folder for your backups. It should also have a trailing "/" in the path. Once you fill in those variables, upload the file to your "includes/cron/" directory and go to your Admin CP > Scheduled Tasks > Add New Scheduled Task and create a new task to run the script. I run mine everynight (as seen in the attachment).

Notes:
The script I have attached is made to backup three different directories. You may add more or take away some. But, make sure if you add more at the top ($backupdir4, $fileprefix4) that you add them to the backupsus call. I used to have these variables set as globals in the function, however that stopped working for me after my last upgrade and instead of figuring out if this was a server issue, I simply changed the script to accommodate the change.

I have heard that some servers do not allow the use of the passthru() function. I can't help with that as I really don't know anything about servers and their personalities. Also, I assume this will work with windows servers also, but I can't help with that either as I have absolutely no experience with windows servers. This works for me and I hope it works for you to. I'm big on having backups around as it helps me sleep better at night.

Update:
1.0.1 - I forgot a semi-colon at the end of the $backupdir lines
1.0.2 - was: $backupattach = "cd $backupdir2;
s/b : $backupattach = "cd $backupdir3;

Lynne 03-08-2008 04:01 PM

Wanted to add to my post.... I actually have two copies of this script running on my board. One that I run that makes a backup of my avatars, profile pictures, and torrents. Then, one hour later, I run one that makes a backup of my attachments. I figured it might be a good idea to spread the load, so to speak, since I have about 7 GB of attachments and only 300 MB of the other files.

Boofo 03-08-2008 07:39 PM

Excellent! Thank you, Lynne. ;)

valdet 03-09-2008 12:47 PM

Installed and interested to see initial feedback before I use it.

Boofo 03-09-2008 12:50 PM

I've been using it and it works like a charm. ;)

athlon64bit 03-09-2008 05:20 PM

Do you intend to update this for vbulletin 3.7 when it goes gold?
It is a fantastic add-on.

Lynne 03-09-2008 06:33 PM

Quote:

Originally Posted by athlon64bit (Post 1460872)
Do you intend to update this for vbulletin 3.7 when it goes gold?
It is a fantastic add-on.

I will update it for 3.7 since I will need it for my board when I upgrade to 3.7.

I'm glad you like it.

edit: Actually, I just ran the script on my 3.7 beta 2 test board and it ran just fine.

Boofo 03-09-2008 06:39 PM

Good job, Lynne! ;)

mystic10 03-09-2008 06:41 PM

what if u want to back up ur posting data everyday..how would i add that...and so sorry for aasking such a silly question but where would my back up folder be

Lynne 03-09-2008 06:52 PM

Quote:

Originally Posted by mystic10 (Post 1460928)
what if u want to back up ur posting data everyday..how would i add that...and so sorry for aasking such a silly question but where would my back up folder be

Posting data is in the database, so you would need to run a database backup cron job, which this is not. This backup script is only for the files in your folders, not for the database information.


All times are GMT. The time now is 02:41 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.01283 seconds
  • Memory Usage 1,738KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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