Link to home
Create AccountLog in
Avatar of Juan Pineiro
Juan PineiroFlag for United States of America

asked on

Moodel backup system, which folder are the backups place in?

I know that moodel has a system to backup or that you can backup classes if you are a teacher and then export them, my question is 2 parts.

1- When doing a backup witht moodle system ( course) (backups) (general backups default) what folders are the backups put in?

2- Are there folders that I can backup with my current backup software that will include the (general backups default)


Avatar of Arty K
Arty K
Flag of Kazakhstan image

Hi, Juan.


1. According to the documentation on 'automated course backup': Automated course backup - MoodleDocs this is the recommended way to make a backup of all classes (not individual courses). You are free to choose the destination folder to put in backups. In their example they use 'D:\Archive' on Windows, but this is not a strict rule, and you are free to choose.
2. The folder that you have chosen on step 1. (in my example D:\Archive) can be used by other external backup software as a source of backup. 


Also, site backups can be done by external tools: one to backup site folder and one to backup MySQL database, as you can read here Site backup - MoodleDocs 

Avatar of Juan Pineiro

ASKER

Arty,


I pretty much followed the document also, I did change the destination folder to a share folder with the following path (\\moodelsrv\moodelbackup) that should work?
I also made it a share folder... not sure if I needed to, but it should work even if it's a share folder?


No sure if I need to change the automated backup storage  

1- (default) course backup filearea

2-Specified directory for automated backups

3-course backup filearea and the specified directory


which one is correct?


Thanks for your help.


User generated image


 I did change the destination folder to a share folder with the following path (\\moodelsrv\moodelbackup) that should work? 


Every path that is accessible from PHP should work. On windows '\\server\share' is a valid path, I guess it should work, but you may need to check. It may require double escaping of backlash like '\\\\server\\share', you should check.

 I also made it a share folder... not sure if I needed to, but it should work even if it's a share folder? 

It doesn't matter if it shared or not, internal backup should work. If it is shared you can backup content from another server.

No sure if I need to change the automated backup storage  

1- (default) course backup filearea

2-Specified directory for automated backups

3-course backup filearea and the specified directory


As I have read, 'course backup filearea' is an internal structure that is not visible from oustide of the Moodle (you can't find it on disk) and operations like copy or move are only accessible from internal scripts. So I recommend to choose 2.




Arty,


Thanks for your input, I'll make the change and update on backup when is done later today, chnaged it to 13:00 hr's 1pm my time EST


Arty


No backup at 1300 hr's, changed the path to d:\\moodelbackup.

hopefully that will work, let you know.

After first backup failure it's time to enable logging. You need php logs, not internal logs of site activity. https://docs.moodle.org/dev/PHP_error_logs Could you enable php error logging and check the log file if there where any errors while backing up? 
When using network share as a path from PHP it may or may not work, depending on how WAMP is running, does it has permissions to the share and what are the registry settings. Mapping to network drive or local directory should work more stable, read StackOverflow. But you can make it working even with network path.


Another possible reason is that it doesn't run at all at specified time (was not scheduled by OS). To check this, look at backup activity log ' Settings > Site administration > Reports > Backups '. Do you see there any entries after the backup has completed?
I have no Moodle installation locally.


Arty


HI, I have been reading regarding the moodle backup and came accross this, (cron ) it seems my is not running. How can I get it to run?
I thin k this must be running to be abale to make a bakup???

Not sure , as you can tell new to  Moodel .

User generated image


Specially for WIndows they recommend to setup their own 'cron' service, which you can get here Cron with Windows OS - MoodleDocs 

Another alternative is to use windows' own  scheduler, but I guess it's more complicated. What it does - it runs every minute PHP interpreter which executes admin/cli/cron.php script.

I downloaded CRON for windows, before I install it can you berify if I have moodel installed on D:\, should I install CRON for windows on the D:\ or just let it install on C:\.


Thank you

Doesn't matter where you install it, it is completely independent from Moodle, I would install it on C:
Its folder should not be accessible by Moodle, but in opposite, Cron should have access to the Moodle's folder to run php scripts.

ok, so I installed it, will not run and can't uninstall it.

Went to control panel and deleted from there but when I try to reinstall says it's installed

folder show this.... really odd

User generated image


but when I go back to the control panel nothing shows to delete,


User generated image


Will update


Thanks

Odd indeed. I just installed it and I see it in 'Control Panel' where I can uninstall... Also you can check services, it is installed as service, check if you have Moodle Cron service running. 

User generated image

User generated image


Also during installation I've noticed that it runs in a strange way. By periodically accessing your site and http://localhost/moondle/admin/cron.php This should work, but you also need to protect this path from accessing from outside (not from localhost), otherwise anyone can run cron.php. This is not dangerous by itself, but it's not secure.

May be you are in a domain where domain policy doesn't allow you to install programs or services?

Just uninstalled, all went smoothly. Uninstalled from disk and from services.

May be you are in a domain where domain policy doesn't allow you to install programs or services? 


I'm the network admin, I just new to this entier moddel, apache.PHP ect....
it's stopped in services




User generated image



Error when I try to install


User generated image


As I see. Program is already installed, just service is not enabled.

Please check the following:

1. You have a MoodleCron.exe in the folder that you have choosen while installing MoodleCron. For me it's a default "C:\Program Files\MoodleCron\MoodleCron.exe". If you don't have, just unpack the installation .exe and put the file there.

2. Your service 'MoodleCron' has the same path to the executable as checked above.

3. Your service is running (I see it is not), If not, enable it and run.


Basically MoodleCron is not needed, everything can be run either manually or via system scheduler. MoodleCron was supposed to be  easier to setup, but something went wrong in your case.

What the service does: 
- it runs continuesly but once a specified (during installation) number of minutes  it accesses URL (also specified during installation). You may specify many URL's but you need only one to run Moodle cron. You may also enable windows logging (and I recommend to enable it) to see the result of each invocation.

These two parameters (how often to access URL and which URL's to access) are configurable in  registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Moodle]
"Logging"=dword:00000000   This turn on and off the eventlog (1=on)
"Interval"=dword:0000000a   This sets the interval in minutes (0xa = 10 minutes)


[HKEY_LOCAL_MACHINE\SOFTWARE\Moodle\Sites]
"1"="http://localhost/moodle/admin/cron.php"
"2"="http://localhost/admin/cron.php"

Open in new window

- after accessing the URL it sleeps speficied (during installation) number of munites (10 by default, but I would use 1) and everything is repeated.

What happens when it tries to access /moodle/admin/cron.php:
- apache from WAMP accepts request
- according to PHP configuration it runs PHP interpreter with cron.php

- cron.php checks if its time to run a job, confgured in Moodle admin area (in you case it's a bckup job) and it it's time and job is not already running it runs it


So exactly the same result you may get without using MoodleCron with any of these approaches:
- when accessing site by address http://localhost/moodle/admin/cron.php manually from browser at specified time
- when running php interpreter with cron.php script from command line manually
- when running the same interpreter from system scheduler (in this case you should find full path to php.exe and your cron.php and just run it once a minute)


Now some words about why all happens at all.  WAMP is basically 3 componennts : Apache + Mysql + PHP. None of them can run periodic tasks. This procedure is system dependant. that's why it's cron configuration is an outsider of Moodle setup, its  platform dependant...

Arty,


Thnak you for your explanation!

I thin k the best way to run it if I understand correclt is by setting it up in wondows schduler?

When I tried to run manually  http://localhost/ecertnow/admin/cron.php I go this, so it works!

User generated image

Could you pls explain exaclty how I can set it up in windows scheduler?

Also whe I ran it I look at the backup folder there is no backup, I did see this in the backup log... why would it have not run the back and place it in the backup folder?


User generated imageand this in the system status


User generated image


Arty,


I went ahead and follwoed this paper on setting up CORN on windows TS.

https://linuxhint.com/set-up-cron-job-windows/#:~:text=To%20set%20up%20the%20cron,run%20as%20a%20cron%20job.


here is how it is currently setp


User generated image


User generated image


User generated image


I'm not 100 % sure if the path is correct, can you provied insight ?


Thank you

Neither wsl.exe nor the URL are correct.


If you have WSL (which is a Windows Subsystem for Linux) installed, then you can use it, however in this case the command should be with parameters 'wsl.exe curl http://localhost/esertnow/admin/cron.php'
BUT you don't need WSL and I don't recommend using it in this context.
You can use existing powershell for that, in this case the command for scheduler should be:

powershell -Command "&{Invoke-WebRequest 'http://localhost/ecertnow/admin/cron.php'}"

Open in new window


 Also don't forget to make it repeated:
User generated image



ok,

changed the time and the path

User generated image


also to be clear and appologies for the stupid question... i'm assuming I don't have to inculed it,but want to be sure.


User generated image


and to be clear you didn't mean for me to put this path


'wsl.exe curl http://localhost/esertnow/admin/cron.php' just from http:// forward, correct.


I'm going to have to buy you a drink after all of this is said and done..

Thank yor for all of your help and hand holding.

no, this is not a part of the command, command is just wsl.exe or powershell, everything else are parameters
User generated image


ok, 

here is the change I did according to your last post

This is correct?


User generated image



Arty,


is this correct? It aske for a user name and password which i inputted and it took it.


User generated image


My action was just an example. Exact 'parameters' should be: curl http://localhost/ecertnow/admin/cron.php 
Your last screenshot looks good. But before running please check that you have wsl.exe, try to run it as a separate command, it should look a console window and command prompt.

Arty,


So i did run curl http://localhost/ecertnow/admin/cron.php on CMD here is the complete output, folowed by a screen shoot.

Microsoft Windows [Version 10.0.20348.2031]

(c) Microsoft Corporation. All rights reserved.


C:\Users\administrator.NETWEB>curl http://localhost/ecertnow/admin/cron.php

Server Time: Fri, 13 Oct 2023 14:59:45 -0400



Execute scheduled task: Complete learning plans which are due (core\task\complete_plans_task)

... started 14:59:45. Current memory use 2.5 MB.

... used 1 dbqueries

... used 0.0030860900878906 seconds

Scheduled task complete: Complete learning plans which are due (core\task\complete_plans_task)

Execute scheduled task: Sync plans from learning plan template cohorts (core\task\sync_plans_from_template_cohorts_task)

... started 14:59:45. Current memory use 3.0 MB.

... used 1 dbqueries

... used 0.0034220218658447 seconds

Scheduled task complete: Sync plans from learning plan template cohorts (core\task\sync_plans_from_template_cohorts_task)

Execute scheduled task: Refresh OAuth tokens for service accounts (core\oauth2\refresh_system_tokens_task)

... started 14:59:45. Current memory use 3.2 MB.

... used 1 dbqueries

... used 0.0010519027709961 seconds

Scheduled task complete: Refresh OAuth tokens for service accounts (core\oauth2\refresh_system_tokens_task)

Execute scheduled task: Send quiz attempt graded notifications (mod_quiz\task\quiz_notify_attempt_manual_grading_completed)

... started 14:59:45. Current memory use 3.6 MB.

Looking for quiz attempts which may need a graded notification sent...

... used 1 dbqueries

... used 0.0039229393005371 seconds

Scheduled task complete: Send quiz attempt graded notifications (mod_quiz\task\quiz_notify_attempt_manual_grading_completed)

Execute scheduled task: Cohort enrolment sync task (enrol_cohort\task\enrol_cohort_sync)

... started 14:59:45. Current memory use 3.7 MB.

... used 7 dbqueries

... used 0.009145975112915 seconds

Scheduled task complete: Cohort enrolment sync task (enrol_cohort\task\enrol_cohort_sync)

Execute scheduled task: Background processing for caches (core\task\cache_cron_task)

... started 14:59:46. Current memory use 3.7 MB.

Cleaning up stale session data from cache stores.

... used 0 dbqueries

... used 0.00223708152771 seconds

Scheduled task complete: Background processing for caches (core\task\cache_cron_task)

Execute scheduled task: Automated backups (core\task\automated_backup_task)

... started 14:59:46. Current memory use 3.8 MB.

Checking automated backup status...OK

Checking courses

Skipping deleted courses...0 courses

Running required automated backups...

... started 14:59:46. Current memory use 5.6 MB.

Getting admin info

Putting backup of course id 2 in adhoc task queue

Putting backup of course id 1 in adhoc task queue

Sending email to admin

Automated backups complete.

... used 19 dbqueries

... used 1.3274199962616 seconds

Scheduled task complete: Automated backups (core\task\automated_backup_task)

Execute scheduled task: Global search indexing (core\task\search_index_task)

... started 14:59:47. Current memory use 6.8 MB.

... used 0 dbqueries

... used 0.0005650520324707 seconds

Scheduled task complete: Global search indexing (core\task\search_index_task)

Execute scheduled task: Analytics cleanup (core\task\analytics_cleanup_task)

... started 14:59:47. Current memory use 6.8 MB.

... used 24 dbqueries

... used 0.09381890296936 seconds

Scheduled task complete: Analytics cleanup (core\task\analytics_cleanup_task)

Execute scheduled task: Award badges (core\task\badges_cron_task)

... started 14:59:47. Current memory use 7.4 MB.

Started reviewing available badges.

Badges were issued 0 time(s).

... used 1 dbqueries

... used 0.0035421848297119 seconds

Scheduled task complete: Award badges (core\task\badges_cron_task)

Execute scheduled task: Background processing for sending badges notifications (core\task\badges_message_task)

... started 14:59:47. Current memory use 7.5 MB.

Sending scheduled badge notifications.

... used 1 dbqueries

... used 0.0054910182952881 seconds

Scheduled task complete: Background processing for sending badges notifications (core\task\badges_message_task)

Execute scheduled task: Sync cohort role assignments (tool_cohortroles\task\cohort_role_sync)

... started 14:59:47. Current memory use 7.5 MB.

Sync cohort roles...

Added 0

Removed 0

... used 3 dbqueries

... used 0.0045039653778076 seconds

Scheduled task complete: Sync cohort role assignments (tool_cohortroles\task\cohort_role_sync)

Execute scheduled task: Cleanup course recycle bin (tool_recyclebin\task\cleanup_course_bin)

... started 14:59:47. Current memory use 7.5 MB.

... used 1 dbqueries

... used 0.0073010921478271 seconds

Scheduled task complete: Cleanup course recycle bin (tool_recyclebin\task\cleanup_course_bin)

Execute scheduled task: Cleanup category recycle bin (tool_recyclebin\task\cleanup_category_bin)

... started 14:59:47. Current memory use 7.5 MB.

... used 1 dbqueries

... used 0.0019540786743164 seconds

Scheduled task complete: Cleanup category recycle bin (tool_recyclebin\task\cleanup_category_bin)

Execute scheduled task: Free up memory used by expired entries in Redis caches (cachestore_redis\task\ttl)

... started 14:59:47. Current memory use 7.4 MB.

No TTL caches assigned to a Redis store; nothing to do.

... used 0 dbqueries

... used 0.0019159317016602 seconds

Scheduled task complete: Free up memory used by expired entries in Redis caches (cachestore_redis\task\ttl)

Execute scheduled task: Background processing for chat module (mod_chat\task\cron_task)

... started 14:59:47. Current memory use 7.4 MB.

... used 4 dbqueries

... used 0.0064549446105957 seconds

Scheduled task complete: Background processing for chat module (mod_chat\task\cron_task)

Execute scheduled task: Background processing for SCORM (mod_scorm\task\cron_task)

... started 14:59:48. Current memory use 7.5 MB.

Updating scorm packages which require daily update

... used 3 dbqueries

... used 0.021297931671143 seconds

Scheduled task complete: Background processing for SCORM (mod_scorm\task\cron_task)

Execute scheduled task: Synchronise manual enrolments task (enrol_manual\task\sync_enrolments)

... started 14:59:48. Current memory use 7.5 MB.

Verifying manual enrolment expiration...

...manual enrolment updates finished.

... used 0 dbqueries

... used 0.0025889873504639 seconds

Scheduled task complete: Synchronise manual enrolments task (enrol_manual\task\sync_enrolments)

Execute scheduled task: Manual enrolment send expiry notifications task (enrol_manual\task\send_expiry_notifications)

... started 14:59:48. Current memory use 7.6 MB.

Processing manual enrolment expiration notifications...

...notification processing finished.

... used 3 dbqueries

... used 0.014620065689087 seconds

Scheduled task complete: Manual enrolment send expiry notifications task (enrol_manual\task\send_expiry_notifications)

Execute scheduled task: Synchronise self enrolments task (enrol_self\task\sync_enrolments)

... started 14:59:48. Current memory use 7.6 MB.

Verifying self-enrolments...

...user self-enrolment updates finished.

No expired enrol_self enrolments detected

... used 2 dbqueries

... used 0.0048661231994629 seconds

Scheduled task complete: Synchronise self enrolments task (enrol_self\task\sync_enrolments)

Execute scheduled task: Self enrolment send expiry notifications task (enrol_self\task\send_expiry_notifications)

... started 14:59:48. Current memory use 7.6 MB.

Processing self enrolment expiration notifications...

...notification processing finished.

... used 3 dbqueries

... used 0.0052220821380615 seconds

Scheduled task complete: Self enrolment send expiry notifications task (enrol_self\task\send_expiry_notifications)

Execute scheduled task: Process bulk batch accessibility checking (tool_brickfield\task\bulk_process_courses)

... started 14:59:48. Current memory use 7.6 MB.

... used 3 dbqueries

... used 0.013187885284424 seconds

Scheduled task complete: Process bulk batch accessibility checking (tool_brickfield\task\bulk_process_courses)

Execute scheduled task: Process bulk caching (tool_brickfield\task\bulk_process_caches)

... started 14:59:48. Current memory use 7.6 MB.

... used 3 dbqueries

... used 0.019886016845703 seconds

Scheduled task complete: Process bulk caching (tool_brickfield\task\bulk_process_caches)

Execute scheduled task: Process content analysis requests (tool_brickfield\task\process_analysis_requests)

... started 14:59:48. Current memory use 7.6 MB.

... used 3 dbqueries

... used 0.029561996459961 seconds

Scheduled task complete: Process content analysis requests (tool_brickfield\task\process_analysis_requests)

Execute scheduled task: Cleanup old sessions (core\task\session_cleanup_task)

... started 14:59:48. Current memory use 7.6 MB.

... used 12 dbqueries

... used 0.023916006088257 seconds

Scheduled task complete: Cleanup old sessions (core\task\session_cleanup_task)

Execute scheduled task: Send new user passwords (core\task\send_new_user_passwords_task)

... started 14:59:48. Current memory use 7.7 MB.

... used 1 dbqueries

... used 0.0067028999328613 seconds

Scheduled task complete: Send new user passwords (core\task\send_new_user_passwords_task)

Execute scheduled task: Send failed login notifications (core\task\send_failed_login_notifications_task)

... started 14:59:48. Current memory use 7.7 MB.

... used 0 dbqueries

... used 0.0012831687927246 seconds

Scheduled task complete: Send failed login notifications (core\task\send_failed_login_notifications_task)

Execute scheduled task: Legacy cron processing for plugins (core\task\legacy_plugin_cron_task)

... started 14:59:48. Current memory use 7.7 MB.

Running auth crons if required...

Running enrol crons if required...

Starting activity modules

Finished activity modules

Starting blocks

Finished blocks

Starting admin reports

Finished admin reports

Starting course reports

Finished course reports

Starting gradebook plugins

Finished gradebook plugins

... used 2 dbqueries

... used 0.019191026687622 seconds

Scheduled task complete: Legacy cron processing for plugins (core\task\legacy_plugin_cron_task)

Execute scheduled task: Background processing for gradebook (core\task\grade_cron_task)

... started 14:59:48. Current memory use 7.8 MB.

... used 2 dbqueries

... used 0.010145902633667 seconds

Scheduled task complete: Background processing for gradebook (core\task\grade_cron_task)

Execute scheduled task: Calculate regular completion data (core\task\completion_regular_task)

... started 14:59:48. Current memory use 7.8 MB.

Aggregating completions

... used 6 dbqueries

... used 0.009876012802124 seconds

Scheduled task complete: Calculate regular completion data (core\task\completion_regular_task)

Execute scheduled task: Background processing for portfolio plugins (core\task\portfolio_cron_task)

... started 14:59:48. Current memory use 7.8 MB.

... used 0 dbqueries

... used 0.00045204162597656 seconds

Scheduled task complete: Background processing for portfolio plugins (core\task\portfolio_cron_task)

Execute scheduled task: Background processing for legacy cron in plagiarism plugins (core\task\plagiarism_cron_task)

... started 14:59:49. Current memory use 7.8 MB.

... used 0 dbqueries

... used 0.00047802925109863 seconds

Scheduled task complete: Background processing for legacy cron in plagiarism plugins (core\task\plagiarism_cron_task)

Execute scheduled task: Send calendar notifications (core\task\calendar_cron_task)

... started 14:59:49. Current memory use 7.8 MB.

... used 1 dbqueries

... used 0.0041561126708984 seconds

Scheduled task complete: Send calendar notifications (core\task\calendar_cron_task)

Execute scheduled task: Sync external blogs (core\task\blog_cron_task)

... started 14:59:49. Current memory use 8.0 MB.

... used 2 dbqueries

... used 0.0025229454040527 seconds

Scheduled task complete: Sync external blogs (core\task\blog_cron_task)

Execute scheduled task: Background processing for cleaning up question previews (core\task\question_preview_cleanup_task)

... started 14:59:49. Current memory use 8.0 MB.


  Cleaning up old question previews...done.

... used 2 dbqueries

... used 0.0041811466217041 seconds

Scheduled task complete: Background processing for cleaning up question previews (core\task\question_preview_cleanup_task)

Execute scheduled task: Send report schedules (core_reportbuilder\task\send_schedules)

... started 14:59:49. Current memory use 8.0 MB.

... used 1 dbqueries

... used 0.0016810894012451 seconds

Scheduled task complete: Send report schedules (core_reportbuilder\task\send_schedules)

Execute scheduled task: Background processing for assignment module (mod_assign\task\cron_task)

... started 14:59:49. Current memory use 8.1 MB.

... used 3 dbqueries

... used 0.011541843414307 seconds

Scheduled task complete: Background processing for assignment module (mod_assign\task\cron_task)

Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)

... started 14:59:49. Current memory use 8.4 MB.

Removing old digest records from 7 days ago.

Removed all old digest records.

Fetching unmailed posts.

  No posts found.

... used 2 dbqueries

... used 0.0035579204559326 seconds

Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task)

Execute scheduled task: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)

... started 14:59:49. Current memory use 8.5 MB.

  Looking for quiz overdue quiz attempts...

  Considered 0 attempts in 0 quizzes.

... used 1 dbqueries

... used 0.0058739185333252 seconds

Scheduled task complete: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)

Execute scheduled task: Recalculate question statistics (quiz_statistics\task\recalculate)

... started 14:59:49. Current memory use 8.6 MB.

... used 1 dbqueries

... used 0.0017049312591553 seconds

Scheduled task complete: Recalculate question statistics (quiz_statistics\task\recalculate)

Execute scheduled task: Legacy cron quiz reports (mod_quiz\task\legacy_quiz_reports_cron)

... started 14:59:49. Current memory use 8.6 MB.

... used 0 dbqueries

... used 0.00069689750671387 seconds

Scheduled task complete: Legacy cron quiz reports (mod_quiz\task\legacy_quiz_reports_cron)

Execute scheduled task: Legacy cron quiz access rules (mod_quiz\task\legacy_quiz_accessrules_cron)

... started 14:59:49. Current memory use 8.6 MB.

... used 0 dbqueries

... used 0.00070095062255859 seconds

Scheduled task complete: Legacy cron quiz access rules (mod_quiz\task\legacy_quiz_accessrules_cron)

Execute scheduled task: Background processing for workshop module (mod_workshop\task\cron_task)

... started 14:59:49. Current memory use 8.6 MB.

 processing workshop subplugins ...

... used 1 dbqueries

... used 0.0017240047454834 seconds

Scheduled task complete: Background processing for workshop module (mod_workshop\task\cron_task)

Execute scheduled task: Legacy cron workshop allocation (mod_workshop\task\legacy_workshop_allocation_cron)

... started 14:59:49. Current memory use 8.6 MB.

... used 0 dbqueries

... used 0.00072193145751953 seconds

Scheduled task complete: Legacy cron workshop allocation (mod_workshop\task\legacy_workshop_allocation_cron)

Execute scheduled task: Incoming email pickup (tool_messageinbound\task\pickup_task)

... started 14:59:49. Current memory use 8.6 MB.

Inbound Message not fully configured - exiting early.

... used 0 dbqueries

... used 0.0007481575012207 seconds

Scheduled task complete: Incoming email pickup (tool_messageinbound\task\pickup_task)

Execute scheduled task: Cleanup event monitor events (tool_monitor\task\clean_events)

... started 14:59:49. Current memory use 8.6 MB.

... used 0 dbqueries

... used 0.00049281120300293 seconds

Scheduled task complete: Cleanup event monitor events (tool_monitor\task\clean_events)

Execute scheduled task: Background processing for scheduled allocation (workshopallocation_scheduled\task\cron_task)

... started 14:59:49. Current memory use 8.6 MB.

... no workshops awaiting scheduled allocation. ... used 1 dbqueries

... used 0.0017480850219727 seconds

Scheduled task complete: Background processing for scheduled allocation (workshopallocation_scheduled\task\cron_task)

Execute adhoc task: core\task\send_login_notifications

Adhoc task id: 12

Adhoc task custom data: {"ismoodleapp":false,"useragent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/118.0.0.0 Safari\/537.36","loginip":"127.0.0.1","logintime":1697223005}

... started 14:59:49. Current memory use 8.7 MB.

Sending login notification to admin

Notification successfully sent

... used 7 dbqueries

... used 0.815593957901 seconds

Adhoc task complete: core\task\send_login_notifications

Execute adhoc task: core\task\course_backup_task

Adhoc task id: 13

Adhoc task custom data: {"courseid":"2","adminid":"2"}

... started 14:59:50. Current memory use 8.7 MB.

Processing automated backup for course: Domain Naming System (DNS)

Automated backup for course: Domain Naming System (DNS) completed.

... used 455 dbqueries

... used 2.1149749755859 seconds

Adhoc task complete: core\task\course_backup_task

Execute adhoc task: core\task\course_backup_task

Adhoc task id: 14

Adhoc task custom data: {"courseid":"1","adminid":"2"}

... started 14:59:52. Current memory use 10.0 MB.

Processing automated backup for course: ECertsNow

Automated backup for course: ECertsNow completed.

... used 168 dbqueries

... used 0.54121398925781 seconds

Adhoc task complete: core\task\course_backup_task

Ran 3 adhoc tasks found at Fri, 13 Oct 2023 14:59:49 -0400

Cron run completed correctly

Cron completed at 14:59:53 in 7.763714 seconds. Memory used: 10.0 MB.


C:\Users\administrator.NETWEB>


User generated image


Below is a snap shoot of the Task Schduler, you can see it's not running, should I leave alone and let it run tonight and moving forwarded it will run every 5 min's?


User generated image


Hi.Sorry, I have missed some important details. 

I changed command from wsl.exe to curl.exe, just need to specify full path, it should be exactly the same for you.

I changed the task from RunOnce to Daily 

Also I added 'Run Hidden' flag, otherwise you will see console windows every 5 minutes. Added 'Run it when not logged in' flag. 

At the end don't forget to 'Run' this task, just to trigger it's execution from the scheduler. Otherwise it will be forever in 'Ready' state.

Here is a series of screenshots that definitely work for me
User generated image

User generated image.User generated image

User generated image

User generated imageIf everything is correct, just create it and Run on demand from Scheduler, you should see 'Last Run Time' and 'Result'


User generated image

After that it sould happen automatically (check server logs and Moodle admin page), not the schedule logs (they will show it as Running).

Here is an example from my server access log to demonstrate it's periodic run (once a 5 minute):
User generated image


Arty,


Followed your above examples, see below.

I right clicked and run, see last screen shoot.


User generated image

User generated image

User generated image


User generated image

User generated image


User generated image

User generated image


User generated image

User generated image


I will check later, it should show that it has been running every 5 mins.


Thank you for your help Arty, I really appreciate it.


You may ignore the last warning (on admin page), because you can't run cron job every minute on Windows scheduler, minmum interval is 5 min and you just can't run it every minute. Even once a 5/min is OK.


What is really wrong is a completion code of the scheduled task. It shows 0x1, this means it is completed with error.
What else is wrong is that the warning shows >6 minutes (should be <5 min) last run time. 


Running cron job doesn't mean that the backup will be created, the backup is scheduled to run at Oct 15, 10:15. Before this time you will not see a new backup in your backup folder.


Everything else looks good. So we need to find why the task is completed with non-zero code.

1. Ensure that you have the binary: C:\Windows\System32\curl.exe
2. Run it manually from cmd.exe with full path and correct URL AND -v flag (verbose): C:\WINDOWS\System32\curl.exe -v http://localhost/ecertnow/admin/cron.php
3. Check the completion code: echo %ERRORLEVEL% It should be 0. If it is not, look at the curl messages for the reason.


Here is an example where I run it with another URL, your URL should be http://localhost/ecertnow/admin/cron.php

User generated image


Ok

Will do ASAP today, doing SWAT medic training until 2 pm


Thanks. 

GM Arty,


On way to Fire Station, on duty today which is why the early reply.

So below is the output from running (C:\WINDOWS\System32\curl.exe -v http://localhost/ecertnow/admin/cron.phpTask logs.csv)


I can't see at the bottom like yours that shows %ERRORLEVEL%0


One thing I should say, when I created the Task and at the end it asked for a username and password.
It would not accept the administrator username and password, it did however allowed me to use my log in of jpineiro with my domain password this account has domain admin rights.



Microsoft Windows [Version 10.0.20348.2031]

(c) Microsoft Corporation. All rights reserved.


C:\Users\administrator.NETWEB>C:\WINDOWS\System32\curl.exe -v http://localhost/ecertnow/admin/cron.php

*   Trying 127.0.0.1:80...

* Connected to localhost (127.0.0.1) port 80 (#0)

> GET /ecertnow/admin/cron.php HTTP/1.1

> Host: localhost

> User-Agent: curl/8.0.1

> Accept: */*

>

< HTTP/1.1 200 OK

< Date: Sun, 15 Oct 2023 08:26:49 GMT

< Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1s PHP/8.0.26 mod_fcgid/2.3.10-dev

< X-Powered-By: PHP/8.0.26

< X-Accel-Buffering: no

< Transfer-Encoding: chunked

< Content-Type: text/plain; charset=utf-8

<

Server Time: Sun, 15 Oct 2023 04:26:50 -0400



Execute scheduled task: Cleanup contexts (core\task\context_cleanup_task)

... started 04:26:50. Current memory use 2.7 MB.

 Cleaned up context instances

... used 11 dbqueries

... used 0.010183095932007 seconds

Scheduled task complete: Cleanup contexts (core\task\context_cleanup_task)

Execute scheduled task: Cleanup old sessions (core\task\session_cleanup_task)

... started 04:26:50. Current memory use 3.2 MB.

... used 7 dbqueries

... used 0.0091519355773926 seconds

Scheduled task complete: Cleanup old sessions (core\task\session_cleanup_task)

Execute scheduled task: Send new user passwords (core\task\send_new_user_passwords_task)

... started 04:26:50. Current memory use 3.2 MB.

... used 1 dbqueries

... used 0.0012898445129395 seconds

Scheduled task complete: Send new user passwords (core\task\send_new_user_passwords_task)

Execute scheduled task: Send failed login notifications (core\task\send_failed_login_notifications_task)

... started 04:26:50. Current memory use 3.2 MB.

... used 0 dbqueries

... used 0.0004420280456543 seconds

Scheduled task complete: Send failed login notifications (core\task\send_failed_login_notifications_task)

Execute scheduled task: Legacy cron processing for plugins (core\task\legacy_plugin_cron_task)

... started 04:26:50. Current memory use 3.2 MB.

Running auth crons if required...

Running enrol crons if required...

Starting activity modules

Finished activity modules

Starting blocks

Finished blocks

Starting admin reports

Finished admin reports

Starting course reports

Finished course reports

Starting gradebook plugins

Finished gradebook plugins

... used 2 dbqueries

... used 0.016212940216064 seconds

Scheduled task complete: Legacy cron processing for plugins (core\task\legacy_plugin_cron_task)

Execute scheduled task: Background processing for gradebook (core\task\grade_cron_task)

... started 04:26:50. Current memory use 3.5 MB.

... used 2 dbqueries

... used 0.0025389194488525 seconds

Scheduled task complete: Background processing for gradebook (core\task\grade_cron_task)

Execute scheduled task: Calculate regular completion data (core\task\completion_regular_task)

... started 04:26:50. Current memory use 3.5 MB.

Aggregating completions

... used 6 dbqueries

... used 0.0088350772857666 seconds

Scheduled task complete: Calculate regular completion data (core\task\completion_regular_task)

Execute scheduled task: Background processing for portfolio plugins (core\task\portfolio_cron_task)

... started 04:26:50. Current memory use 3.6 MB.

... used 0 dbqueries

... used 0.0003969669342041 seconds

Scheduled task complete: Background processing for portfolio plugins (core\task\portfolio_cron_task)

Execute scheduled task: Background processing for legacy cron in plagiarism plugins (core\task\plagiarism_cron_task)

... started 04:26:50. Current memory use 3.6 MB.

... used 0 dbqueries

... used 0.00038695335388184 seconds

Scheduled task complete: Background processing for legacy cron in plagiarism plugins (core\task\plagiarism_cron_task)

Execute scheduled task: Send calendar notifications (core\task\calendar_cron_task)

... started 04:26:50. Current memory use 3.6 MB.

... used 1 dbqueries

... used 0.0076057910919189 seconds

Scheduled task complete: Send calendar notifications (core\task\calendar_cron_task)

Execute scheduled task: Sync external blogs (core\task\blog_cron_task)

... started 04:26:50. Current memory use 3.7 MB.

... used 2 dbqueries

... used 0.0016400814056396 seconds

Scheduled task complete: Sync external blogs (core\task\blog_cron_task)

Execute scheduled task: Background processing for cleaning up question previews (core\task\question_preview_cleanup_task)

... started 04:26:50. Current memory use 3.7 MB.


  Cleaning up old question previews...done.

... used 2 dbqueries

... used 0.0033400058746338 seconds

Scheduled task complete: Background processing for cleaning up question previews (core\task\question_preview_cleanup_task)

Execute scheduled task: Award badges (core\task\badges_cron_task)

... started 04:26:50. Current memory use 4.0 MB.

Started reviewing available badges.

Badges were issued 0 time(s).

... used 1 dbqueries

... used 0.0017209053039551 seconds

Scheduled task complete: Award badges (core\task\badges_cron_task)

Execute scheduled task: Background processing for sending badges notifications (core\task\badges_message_task)

... started 04:26:50. Current memory use 4.1 MB.

Sending scheduled badge notifications.

... used 1 dbqueries

... used 0.0012011528015137 seconds

Scheduled task complete: Background processing for sending badges notifications (core\task\badges_message_task)

Execute scheduled task: Send report schedules (core_reportbuilder\task\send_schedules)

... started 04:26:51. Current memory use 4.1 MB.

... used 1 dbqueries

... used 0.0013840198516846 seconds

Scheduled task complete: Send report schedules (core_reportbuilder\task\send_schedules)

Execute scheduled task: Background processing for assignment module (mod_assign\task\cron_task)

... started 04:26:51. Current memory use 4.2 MB.

... used 3 dbqueries

... used 0.014266014099121 seconds

Scheduled task complete: Background processing for assignment module (mod_assign\task\cron_task)

Execute scheduled task: Background processing for chat module (mod_chat\task\cron_task)

... started 04:26:51. Current memory use 4.4 MB.

... used 4 dbqueries

... used 0.0035400390625 seconds

Scheduled task complete: Background processing for chat module (mod_chat\task\cron_task)

Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)

... started 04:26:51. Current memory use 4.6 MB.

Removing old digest records from 7 days ago.

Removed all old digest records.

Fetching unmailed posts.

  No posts found.

... used 2 dbqueries

... used 0.0026438236236572 seconds

Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task)

Execute scheduled task: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)

... started 04:26:51. Current memory use 4.8 MB.

  Looking for quiz overdue quiz attempts...

  Considered 0 attempts in 0 quizzes.

... used 1 dbqueries

... used 0.0034730434417725 seconds

Scheduled task complete: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)

Execute scheduled task: Legacy cron quiz reports (mod_quiz\task\legacy_quiz_reports_cron)

... started 04:26:51. Current memory use 4.8 MB.

... used 0 dbqueries

... used 0.00078415870666504 seconds

Scheduled task complete: Legacy cron quiz reports (mod_quiz\task\legacy_quiz_reports_cron)

Execute scheduled task: Legacy cron quiz access rules (mod_quiz\task\legacy_quiz_accessrules_cron)

... started 04:26:51. Current memory use 4.8 MB.

... used 0 dbqueries

... used 0.00066685676574707 seconds

Scheduled task complete: Legacy cron quiz access rules (mod_quiz\task\legacy_quiz_accessrules_cron)

Execute scheduled task: Background processing for SCORM (mod_scorm\task\cron_task)

... started 04:26:51. Current memory use 4.9 MB.

... used 0 dbqueries

... used 0.00081110000610352 seconds

Scheduled task complete: Background processing for SCORM (mod_scorm\task\cron_task)

Execute scheduled task: Background processing for workshop module (mod_workshop\task\cron_task)

... started 04:26:51. Current memory use 4.9 MB.

 processing workshop subplugins ...

... used 1 dbqueries

... used 0.0062868595123291 seconds

Scheduled task complete: Background processing for workshop module (mod_workshop\task\cron_task)

Execute scheduled task: Legacy cron workshop allocation (mod_workshop\task\legacy_workshop_allocation_cron)

... started 04:26:51. Current memory use 4.9 MB.

... used 0 dbqueries

... used 0.00066494941711426 seconds

Scheduled task complete: Legacy cron workshop allocation (mod_workshop\task\legacy_workshop_allocation_cron)

Execute scheduled task: Process bulk batch accessibility checking (tool_brickfield\task\bulk_process_courses)

... started 04:26:51. Current memory use 4.1 MB.

... used 3 dbqueries

... used 0.012535095214844 seconds

Scheduled task complete: Process bulk batch accessibility checking (tool_brickfield\task\bulk_process_courses)

Execute scheduled task: Process bulk caching (tool_brickfield\task\bulk_process_caches)

... started 04:26:51. Current memory use 4.1 MB.

... used 3 dbqueries

... used 0.012766122817993 seconds

Scheduled task complete: Process bulk caching (tool_brickfield\task\bulk_process_caches)

Execute scheduled task: Process content analysis requests (tool_brickfield\task\process_analysis_requests)

... started 04:26:51. Current memory use 4.2 MB.

... used 3 dbqueries

... used 0.013175964355469 seconds

Scheduled task complete: Process content analysis requests (tool_brickfield\task\process_analysis_requests)

Execute scheduled task: Incoming email pickup (tool_messageinbound\task\pickup_task)

... started 04:26:51. Current memory use 4.2 MB.

Inbound Message not fully configured - exiting early.

... used 0 dbqueries

... used 0.0007171630859375 seconds

Scheduled task complete: Incoming email pickup (tool_messageinbound\task\pickup_task)

Execute scheduled task: Cleanup event monitor events (tool_monitor\task\clean_events)

... started 04:26:51. Current memory use 4.2 MB.

... used 0 dbqueries

... used 0.0017521381378174 seconds

Scheduled task complete: Cleanup event monitor events (tool_monitor\task\clean_events)

Execute scheduled task: Background processing for scheduled allocation (workshopallocation_scheduled\task\cron_task)

... started 04:26:51. Current memory use 4.2 MB.

... no workshops awaiting scheduled allocation. ... used 1 dbqueries

... used 0.0078048706054688 seconds

Scheduled task complete: Background processing for scheduled allocation (workshopallocation_scheduled\task\cron_task)

Ran 0 adhoc tasks found at Sun, 15 Oct 2023 04:26:52 -0400

Cron run completed correctly

Cron completed at 04:26:52 in 1.886694 seconds. Memory used: 4.2 MB.

* Connection #0 to host localhost left intact

Hi,
I wish you a peacful duty.
Last command with ERRORLEVEL is what I entered myself, just enter and run it.

Password of the user is required. Because the task is intended to run even when none is logged in. So it should login as that user.
You may create a user without any privileges, and definitely without administrator rights. Even not a domain user, local is enough.


Output of the curl looks good, so this error might happen because of wrong user/password.

Thanks,

Hopefully it will be a slow day, but some of the busiest days have been on Sundays early morning due to drunks coming home at early hrs. 


Ok

So I’m using a username and password that has admin rights on the network/domain. 

That should work, correct?

Should I create a local user?


Also I don’t see the task running every 5 mins as it is setup. 


So you mean to says it not running every 5 mins due to the username and password, even if it takes it when I input it?


Now what???

i ran the command, not show what to make of it...

I google it and got this, but clueless as to exactly what it means?


User generated image

User generated image


Have you ran it right after curl? It has meaning only after just executed command.

It's not a standalone command.


Run curl with cron.php then immediately "echo %ERRORLEVEL%"

So I’m using a username and password that has admin rights on the network/domain. 

You should change to another user.

That should work, correct?

This should work, yes, just insecure.


Also I don’t see the task running every 5 mins as it is setup. 

Where did you look at this task? Look at the Moodle admin area where 'cron' warning, it will show how far ago it was run. Also you may check server's access.log. But it may not be visible in Windiws scheduler


So you mean to says it not running every 5 mins due to the username and password, even if it takes it when I input it?


Not it should. If username and password were correct and you checked 'Save password' it should work periodically.


Now what???


Now we are troubleshooting why it ran with non-zero completion status.

ohhhhh... I see what you mean.

no I did not, but I think it's working

I took a look at the Server / status and saw this


User generated image

loo at the time, then I went back in approx 5 mins later and saw this.


User generated image


again, look at the time... If I'm understanding and reading it corredtly it is running every 5 mins like set up on Task.. at 10:15 there should be a backup.


last showed this

User generated image


User generated imageI'll update you 


Arty,


Seems to me that the Task is runing, however the backups remain the same.


User generated image




User generated image

should the backup not run when the task runs and finds a task that is not complete?

OK, 

So I think I see why it's not runing at 10:15...

I must have changed it ( see below ) will wait til tonight to see if it runs.

Will update you.

Have a nice day Arty...

Thanks for everything!


User generated image


Have a good day, Juan. I hope everything will work now. Just wait when backup appears.

Arty,


Good news!


The update was done. 

Seems like my time is off. Should be a quick fix. Suggestions?


User generated image


ASKER CERTIFIED SOLUTION
Avatar of Arty K
Arty K
Flag of Kazakhstan image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer

All is good Arty, 

Life is great!


Thank you so very much for all of your help!

Arty is a professional...
Explained everyting in detailed and easy to understand.

Was able to follow his example and suggestions without any problems or second guessing myself.
In a short time I had issue fix.

You are welcome!