Thursday, July 26, 2012

Don't forget to create a Cron service on the new servers



It is time to install my Cron script that is so important to moodle.  Following directions from moodle docs on cron.  Also this more specific moodle doc page for croning in windows.

I am downloading from here a file that will create a Windows service that will call the cron.php file.

I will install one Windows service per server, I will specify during the install of the service the URLs of the cron.php file.  One per moodle install.  If I have 4 moodle instances on a server, I will end up with 1 Windows service that specifies 4 URLs, each URL is calling the cron.php file for a separate instance.

I will specify an interval of every 20 minutes to call the Windows service.

After installing the script I can see in the Services a new service called Moodle Cron with status of started and a Startup Type of Automatic.

When installing the service, I also specified to allow it to write to the windows logs.

I followed a suggestion of manually calling the cron.php script by browsing to it, this was the FIRST time i had called this script since the install of the instance.  This is a screen grab of its details:
"
Server Time: Thu, 26 Jul 2012 14:45:17 +0000

Created missing context instances
Cleaned up stale user sessions
Running auth crons if required...
Running enrol crons if required...
Running cron for enrol_self...
Running cron for enrol_cohort...
Starting activity modules
Processing module function assign_cron ...done.
... used 6 dbqueries
... used 0.24495100975037 seconds
done.
Processing module function chat_cron ...... used 6 dbqueries
... used 0.045751094818115 seconds
done.
Processing module function forum_cron ...Starting digest processing...
Cleaned old digest records
... used 8 dbqueries
... used 0.060887098312378 seconds
done.
Processing module function quiz_cron ...
  Looking for quiz overdue quiz attempts between Thursday, 1 January 1970, 12:00 AM and Thursday, 26 July 2012, 2:44 PM...
  Considered 0 attempts in 0 quizzes.
Starting quiz reports
Processing cron function for quiz_statistics...
done. (1 dbqueries, 0 seconds)
Finished quiz reports
... used 11 dbqueries
... used 0.1676881313324 seconds
done.
Processing module function scorm_cron ...Updating scorm packages which require daily update
... used 7 dbqueries
... used 0.025831937789917 seconds
done.
Processing module function workshop_cron ... processing workshop subplugins ...
Starting workshop allocation methods
Processing cron function for workshopallocation_scheduled...
... no workshops awaiting scheduled allocation. done. (1 dbqueries, 0 seconds)
Finished workshop allocation methods
... used 6 dbqueries
... used 0.047085046768188 seconds
done.
Finished activity modules
Starting blocks
Processing cron function for rss_client....
0 feeds refreshed (took 0.014437 seconds)
done.
Finished blocks
Starting admin reports
Finished admin reports
Starting main gradebook job...
done.
Starting processing the event queue...
done.
Starting the completion cron...
done
Starting course reports
Finished course reports
Starting gradebook plugins
Finished gradebook plugins
Fetching external blog entries...done.
Deleting blog associations linked to non-existent contexts...done.
Starting registration update on hubs...
Finished registration update on hubs.
Outdated or missing info about available updates, forced fetching ... sending notifications ... Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email_to_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email_to_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email_to_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email_to_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email_to_user(): Could not instantiate mail function.
done
Deleting session linked tokens more than one day old...done.
Starting repository plugins
Processing cron function for repository_dropbox...
done. (1 dbqueries, 0 seconds)
Finished repository plugins
Starting admin tools
Processing cron function for tool_qeupgradehelper...
done. (1 dbqueries, 0 seconds)
Finished admin tools
Checking automated backup status...INACTIVE
Deleting old draft files... done.
Deleting orphaned preview files... done.
Cleaning up files from deleted contexts... done.
Deleting trash files... done.
Clean up cached external files
Cron script completed correctly
Execution took 11.762365 seconds"
 
Interesting, you can get a good idea of what the script is doing in moodle, keeping things
fresh.  I also see I have to probably register the server ip for emailing to work. I see a 
total of 11 seconds, I am curious to see if the next time I run the script, it will be a little
faster, since some of those tasks may be a one time execution.

Oy yes, after refreshing the page in the browser, calling the cron again, the execution time is
Execution took 0.615031 seconds
 

2 comments:

  1. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingmulesoft online training Hyderabad

    ReplyDelete
  2. Thanks for this Great Information.
    For additional info, if you need Professional AC Rental Service in Indonesia for something like event or anything elese, you can try to reach us. We will be very happy to assist you.

    Thanks again.

    ReplyDelete