*Edit* To save anyone time looking for answers to the same problem I have added below the answer that i feel solved my problem. Cheers!
Answer:
"Scheduled tasks are not necessarily executed at the exact moment they are scheduled. When a page is loaded, any pending scheduled tasks are run at that time. If you have a scheduled task that you want to run at 2AM every night but you site isn't getting any traffic at that time then the scheduled task will not be run until your next visitor loads a page." -dcarver
My scheduled task's are executing with no errors and doing what they are supposed to do however after the first time they run they only run again when the scheduled task tab "Reset" button is hit. I was reading other scripts and i came across a segment of code that i believes makes a reference to this but i don't understand what the comment is referencing. Below is the section of code i found. This code is inside the "mmlsk-templateorderemails.mv". Essentially im looking for a bit of help in understanding why after my scheduled task executes the first time it wont execute again until i refresh the tasks.
Answer:
"Scheduled tasks are not necessarily executed at the exact moment they are scheduled. When a page is loaded, any pending scheduled tasks are run at that time. If you have a scheduled task that you want to run at 2AM every night but you site isn't getting any traffic at that time then the scheduled task will not be run until your next visitor loads a page." -dcarver
My scheduled task's are executing with no errors and doing what they are supposed to do however after the first time they run they only run again when the scheduled task tab "Reset" button is hit. I was reading other scripts and i came across a segment of code that i believes makes a reference to this but i don't understand what the comment is referencing. Below is the section of code i found. This code is inside the "mmlsk-templateorderemails.mv". Essentially im looking for a bit of help in understanding why after my scheduled task executes the first time it wont execute again until i refresh the tasks.
Code:
<MvASSIGN NAME = "l.run" VALUE = "">
<MvASSIGN NAME = "l.run:on_pc_exp" VALUE = 1>
<MvASSIGN NAME = "l.run:paymentcard" VALUE = "{ l.paymentcard }">
<MvASSIGN NAME = "l.run:paymentcard:customer:primaddr" VALUE = "{ l.std_fields:primaddr }">
<MvCOMMENT>
|
| Mark the email as sent before sending it, so that any errors will not perpetually block future scheduled task executions
|
</MvCOMMENT>
<MvASSIGN NAME = "l.null" VALUE = "{ TemplateOrderEmailXPaymentCard_Insert( l.email:id, l.paymentcard:id, s.dyn_time_t ) }">
<MvIF EXPR = "{ NOT TemplateOrderEmails_SendEmail( l.run, l.email ) }">
<MvASSIGN NAME = "l.null" VALUE = "{ [ g.Module_Feature_SCH_DB ].ScheduledTaskLog_Insert( l.task:id, 'E', 'Unable to send notification for card ending in \'' $ l.paymentcard:lastfour $ '\' for customer \'' $ l.paymentcard:customer:login $ '\': ' $ g.Error_Message ) }">
<MvELSE>
<MvCOMMENT>My current task code, feel free to critique on anything you see off ;D </MvCOMMENT>
<MvFUNCTION NAME = "Run_New_Scan" PARAMETERS = " task var" STANDARDOUTPUTLEVEL = "">
<MvASSIGN NAME = "g.newScanDebug" VALUE = "{'-------------------- Starting new Scan.... ' $ asciichar(9)}">
<MvCOMMENT> Sets blank variable to hold the Business account list </MvCOMMENT>
<MvASSIGN NAME = "l.BusinessAccounts" VALUE = "">
<MvCOMMENT> Loads list into the 'l.Club.List' Variable </MvCOMMENT>
<MvEVAL EXPR = "{ Load_Active_BA_List( l.BusinessAccounts )}">
<MvCOMMENT> Sets blank variable to hold the member list </MvCOMMENT>
<MvASSIGN NAME = "l.List" VALUE = "">
<MvCOMMENT> Loads list into the 'l.Club.List' Variable </MvCOMMENT>
<MvEVAL EXPR = "{ Load_Member_List( l.List )}">
<MvASSIGN NAME = "l.new_count" VALUE = 0 >
<MvCOMMENT> Loop thru all accounts with club member business account, and check if the tracked list contains each one </MvCOMMENT>
<MvFOREACH ITERATOR = "l.item" ARRAY = "l.BusinessAccounts" INDEX = "l.pos">
<MvCOMMENT> Checks to see if the account is already being tracked </MvCOMMENT>
<MvIF EXPR = "{ miva_array_search( l.List, 0, l.element, 'l.element:id EQ ' $ l.item:user_id ) }">
<MvCOMMENT> Account already being tracked, do nothing (TODO: could change to 'EXPR = NOT' and avoid the extra <MvELSE>) </MvCOMMENT>
<MvASSIGN NAME = "g.newScanDebug" VALUE = "{g.newScanDebug $ 'Account Already Tracked! BA_id: ' $ l.item:id $ g.MvOPENVIEW_Error }">
<MvELSE>
<MvASSIGN NAME = "g.newScanDebug" VALUE = "{g.newScanDebug $ 'Found Account Not Being Tracked! BA_id: ' $ l.item:id $ asciichar(9)}">
<MvCOMMENT> Business account not found in stored list. Must now add it to list with date </MvCOMMENT>
<MvEVAL EXPR = "{ ClubList_Insert_By_ID( l.item:id) }">
<MvASSIGN NAME = "l.new_count" VALUE = "{l.new_count + 1}" >
</MvIF>
</MvFOREACH>
<MvIF EXPR = "{ l.new_count LT 1 }">
<MvASSIGN NAME = "g.newScanDebug" VALUE = "{g.newScanDebug $ ' No New Accounts added ' $ asciichar(9)}">
</MvIF>
<MvASSIGN NAME = "g.newScanDebug" VALUE = "{ g.newScanDebug $ ' End New Scan --------------------------- ' $ asciichar(9)}">
<MvEXPORT FILE = " MDC_NewScanDebug.txt "
DELIMITER = "{ l.null }"
FIELDS = "g.newScanDebug">
<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>
Comment