The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Cron job for Files Backup (attachments, avatars, etc.) Details »» | |||||||||||||||||||||||||||
Cron job for Files Backup (attachments, avatars, etc.)
Developer Last Online: Oct 2022
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; Show Your Support
|
Comments |
#22
|
|||
|
|||
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! |
#23
|
|||
|
|||
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 ? |
#24
|
||||
|
||||
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/"
|
#25
|
|||
|
|||
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:
|
#26
|
|||
|
|||
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"); } Code:
$backupattach = "cd $backupdir3; tar $tararg {$fileprefix3}{$backupdate}.tar $files; mv {$fileprefix3}{$backupdate}.tar $backupto"; passthru ("$backupattach"); } |
#27
|
||||
|
||||
Yikes! Good catch! Updated.
|
#28
|
|||
|
|||
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. |
#29
|
||||
|
||||
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.
|
#30
|
||||
|
||||
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. |
#31
|
||||
|
||||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|