Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Cron job for Files Backup (attachments, avatars, etc.) Details »»
Cron job for Files Backup (attachments, avatars, etc.)
Version: 1.0.2, by Lynne Lynne is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.6.x Rating:
Released: 03-07-2008 Last Update: 02-19-2009 Installs: 15
Re-useable Code Additional Files  
No support by the author.

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;

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-08-2008, 04:01 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 03-08-2008, 07:39 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent! Thank you, Lynne.
Reply With Quote
  #4  
Old 03-09-2008, 12:47 PM
valdet's Avatar
valdet valdet is offline
 
Join Date: Feb 2007
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and interested to see initial feedback before I use it.
Reply With Quote
  #5  
Old 03-09-2008, 12:50 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've been using it and it works like a charm.
Reply With Quote
  #6  
Old 03-09-2008, 05:20 PM
athlon64bit athlon64bit is offline
 
Join Date: Mar 2007
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you intend to update this for vbulletin 3.7 when it goes gold?
It is a fantastic add-on.
Reply With Quote
  #7  
Old 03-09-2008, 06:33 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by athlon64bit View Post
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.
Reply With Quote
  #8  
Old 03-09-2008, 06:39 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good job, Lynne!
Reply With Quote
  #9  
Old 03-09-2008, 06:41 PM
mystic10 mystic10 is offline
 
Join Date: Sep 2007
Posts: 298
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 03-09-2008, 06:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mystic10 View Post
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:31 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04458 seconds
  • Memory Usage 2,289KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete