vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   vB3 cron system (https://vborg.vbsupport.ru/showthread.php?t=61327)

filburt1 02-08-2004 06:55 PM

vB3 cron system
 
What is the CLEAN (i.e., not exit!) way of ending a cron script?

For example, I have this function:
PHP Code:

function autoimapdie($result)
{
    global 
$logprefix;
    
    if (
$result === false)
    {
        
$errors imap_errors();
        
$warnings imap_warnings();
        
$messages array_merge($errors$warnings);
        
        foreach (
$messages as $key => $value)
        {
            
$messages[$key] = htmlspecialchars_uni($value);
        }
        
        if (!empty(
$messages))
        {
            
$messages htmlspecialchars("\"" implode("\", \""$messages) . "\"");
            
            
log_cron_action("$logprefix Failed due to imap errors or warnings: $messages",
                    
$nextitem);
        }
    }


After the log_cron_action line, how can I return control back to the original cron control script?

MindTrix 02-08-2004 07:07 PM

My host says return;

dunno if thats any help :p

filburt1 02-08-2004 08:12 PM

Quote:

Originally Posted by MindTrix
My host says return;

dunno if thats any help :p

That will merely exit out of the function. There is code calling the function that will continue to get executed.

I don't want to edit any of vB's files, if possible, as this is for vBMS and I'm avoiding that for this release.

filburt1 02-08-2004 08:29 PM

A thought occurs: is there an exit handler function that will make a graceful exit anyway when exit is used?

MindTrix 02-08-2004 08:32 PM

How do you mean? (me lost) my host still swears u should use exit at the end of the cron line

filburt1 02-08-2004 08:33 PM

Quote:

Originally Posted by MindTrix
How do you mean? (me lost) my host still swears u should use exit at the end of the cron line

Does your host know that I'm talking about vB3's cron system and not a standard Unix cron (i.e., crontab, etc.) setup?

MindTrix 02-08-2004 08:36 PM

Doh! :( Sorry for wasting your time Filburt.

g-force2k2 02-08-2004 11:23 PM

Filburt isn't control given automatically given back to the main cron script as it loops through each required file? Unless your function isn't itself going to be a cron script.

Cheers,
g-force2k2

filburt1 02-09-2004 12:17 AM

Quote:

Originally Posted by g-force2k2
Filburt isn't control given automatically given back to the main cron script as it loops through each required file? Unless your function isn't itself going to be a cron script.

Cheers,
g-force2k2

Well for example:
PHP Code:

// is vBMS even enabled?
debugecho("Checking for vBMS enabled...");
if (!
$vboptions['vbms_enabled'])
{
    
log_cron_action("$logprefix mail check ignored: vBMS is not enabled"$nextitem);


After that log entry, the script should hand control over to the next scheduled cron job (if any). As it is now (as I understand it, at least), it will just continue running, even though a known failure point was effectively ignored.

g-force2k2 02-09-2004 02:16 AM

Could not not define a global variable that is ran through each loop and if an error is occured then instead of continuing the while loop it could instead break out, and if necessary first build a new cron log? Just an idea.

Cheers,
g-force2k2


All times are GMT. The time now is 03:13 AM.

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.01019 seconds
  • Memory Usage 1,746KB
  • 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_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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