Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Cron job for Files Backup (attachments, avatars, etc.) Details »
Cron job for Files Backup (attachments, avatars, etc.)
Mod Version: 1.0.2, by Lynne (Coder/Designer) Lynne is offline
Developer Last Online: Aug 2019 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.7.x Rating: (2 votes - 5.00 average) Installs: 24
Released: 10 Mar 2008 Last Update: 20 Feb 2009 Downloads: 164
Not Supported Additional Files Re-usable Code Translations  

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 every night (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.

And, thanks to Boofo for encouraging me to release my first modification!

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;

Download Now

Only licensed members can download files, Click Here for more information.

Screenshots

Click image for larger version

Name:	backup1.png
Views:	559
Size:	49.1 KB
ID:	77049  

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • If you like this modification support the author by donating.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Administrative and Maintenance Tools Site Backup (easily backup your forum files) bairy vBulletin 3.6 Add-ons 54 06 Jun 2009 16:07
Administrative and Maintenance Tools Cron job for Files Backup (attachments, avatars, etc.) Lynne vBulletin 3.6 Add-ons 16 19 Apr 2008 13:07

Comments
  #2  
Old 10 Mar 2008, 17:10
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
My test site is running 3.7 beta 2 and this script works fine. I don't see any reason why it won't work on the newer versions.
Reply With Quote
  #3  
Old 10 Mar 2008, 17:42
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Real name: Tim Eason
Nice! Thanks! *installed*
Reply With Quote
  #4  
Old 21 Apr 2008, 20:53
Jase2 Jase2 is offline
 
Join Date: Dec 2007
I was thinking of something like this, too. Very handy! Thanks, Lynne. Will install tomorrow, as I currently have a lot on my plate hehe.
Reply With Quote
  #5  
Old 22 Apr 2008, 00:07
yinyang's Avatar
yinyang yinyang is offline
 
Join Date: May 2004
does/can this also backup the database?
__________________
Font Resizer 1.00 [vB3.5]
Panic Button 1.01 [vB3.07] [vB3.5]
Reply With Quote
  #6  
Old 22 Apr 2008, 20:23
Jase2 Jase2 is offline
 
Join Date: Dec 2007
No, it doesn't backup the database. You would need a mod such as this for that: http://www.vbulletin.org/forum/showthread.php?t=167276

Installed, Lynne! Thanks.
Reply With Quote
  #7  
Old 22 Apr 2008, 20:36
Jase2 Jase2 is offline
 
Join Date: Dec 2007
Hi Lynne,

Getting the following:

Parse error: syntax error, unexpected T_STRING in /home/user/public_html/forum/includes/cron/attachbackupscript.php on line 9
Can't figure it out at the moment. Need some sleep lol. I've added an extra directory to backup albums, but I've just added $backupdir4 and $fileprefix4 every where after $backupdir4. Any ideas ?
Reply With Quote
  #8  
Old 22 Apr 2008, 20:43
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Hmmm, error on line 9. My line 9 is blank.

Make sure your $backupdir4 ends with a trailing slash. Also, make sure when you call the function with "backupsus ($.....)" that the order of the variables in there is the same as the order of variables in the "function backupsus ($.....)"

Uh oh... I just noticed I'm missing a semi-colon at the end of the $backupdir2 and $backupdir3. The $backupdir lines should look like this:

$backupdir1 = "/my/path/to/avatars/";
$backupdir2 = "/my/path/to/customprofilepics/";
$backupdir3 = "/my/path/to/attachments/";

I'll update the first post with the corrected file.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #9  
Old 22 Apr 2008, 21:04
Jase2 Jase2 is offline
 
Join Date: Dec 2007
All becomes clear...

Thanks!
Reply With Quote
  #10  
Old 22 Apr 2008, 21:10
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by Jase2 View Post
All becomes clear...

Thanks!
Thanks for pointing that out. I guess I dropped the semi-colon when I made the file 'generic' to be released.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #11  
Old 22 Apr 2008, 21:12
Jase2 Jase2 is offline
 
Join Date: Dec 2007
Still getting the same error. Hmmm......
Reply With Quote
  #12  
Old 22 Apr 2008, 22:21
Jase2 Jase2 is offline
 
Join Date: Dec 2007
Here's my attached file, Lynne -- as my email client is acting up lol.
Attached Files
File Type: php attachbackupscript.php (2.4 KB, 7 views)
Reply With Quote
  #13  
Old 22 Apr 2008, 22:28
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
For some reason, the lines are getting all run together by your editor and that is why you are getting the error.

For instance, your file line 1 shows:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Whereas it should only be:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I will email a fresh copy of the script to you. This is very strange! You are the first person to say this has happened to the file.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #14  
Old 22 Apr 2008, 22:37
Jase2 Jase2 is offline
 
Join Date: Dec 2007
I believe that is from:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I'm using CofeeCup HTML editor 2008, paid version.

Just ran it again, and it worked. However, files are not showing up. I've cmod the backups folder, still isn't working. This is really strange.
Reply With Quote
  #15  
Old 22 Apr 2008, 22:42
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by Jase2 View Post
I believe that is from:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I'm using CofeeCup HTML editor 2008, paid version.

Just ran it again, and it worked. However, files are not showing up. I've cmod the backups folder, still isn't working. This is really strange.
I know what the code is from, however it is on line two of my script and if you look at what you attached, line 2 of my script is merged in which line 1 in your attached script. And, that happened with several lines. Very weird, as I said. I'm not sure why that would happen. I am just using a simple text editor, BBEdit, to write it and I don't think it should cause that problem. Who knows.

Is the action getting logged, just not producing any output? Are you getting any files output? Did you run it 'as-is' or with your modifications? Do you know if passthru() is an allowable function on your server?
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 11:52.

Layout Options | Width: Wide Color: