vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   cron job for a SQL function??? (https://vborg.vbsupport.ru/showthread.php?t=192914)

ATVTorture 10-06-2008 11:54 PM

cron job for a SQL function???
 
Is there a way to create a scheduled task that will run a SQL query. I would like to create one that will run on schedule a SQL function that, at say 3AM (a low user load time), that will make a copy of my database with a date and time stamp on the name it saves. I can handle the date and time stamp on the file name with SQL. I just need to know if I can automate the SQL function.

Thanks!
Buster

Eikinskjaldi 10-06-2008 11:58 PM

You can drop a vb script (with access to the mysql classes) into includes/cron and set it up as a cron in the admincp.

Alternatively, you can use a scripting language with mysql support and set it up using the system cron.

Both ways will work fine, although with the vb approach the cron will fire the first time someone (anyone) views some part of your site on or after your trigger time.

ATVTorture 10-07-2008 12:35 AM

OK, you just went over my head. How do I implment what you're saying?

Thanks!
Buster

Lynne 10-07-2008 02:33 AM

Yes, you can do it. All the cron jobs are kept in the includes/cron/ folder. Just find a simple one, give it a new name, remove the code in the middle, and add your own code instead. Save. Create a scheduled task to run it.

ATVTorture 10-07-2008 05:15 PM

OK, maybe I was giving myself too much credit. How would I write the script to just get it to make a copy and save it somewhere on the server with a static name. In other words if my DB is called vbdatabase and I want it to dump to a folder off the root called backup, overwriting the previous file, how would I code that?

Thanks!

Lynne 10-07-2008 05:31 PM

Have you thought of installing one of the mods written to already do this? (search "backup" "all mods" "titles only")

ATVTorture 10-07-2008 08:12 PM

Holy cow, wouldn't have thought there was such a mod out there. Wonder if there's one that can do a backup of an entire folder like that. Spose I'll have to search for that too now.

Thanks for pointing me in the right direction Lynne.

Buster

Lynne 10-07-2008 08:15 PM

Quote:

Originally Posted by ATVTorture (Post 1639723)
Holy cow, wouldn't have thought there was such a mod out there. Wonder if there's one that can do a backup of an entire folder like that. Spose I'll have to search for that too now.

Look no further than my profile for that sort of mod. It's the only mod I've ever submitted. :D

ATVTorture 10-07-2008 08:47 PM

Sweet, i was just looking at that mod!

Great work Lynne!

Buster


All times are GMT. The time now is 10:00 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.01149 seconds
  • Memory Usage 1,724KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete