Installing and upgrading help

Cron as a scheduled task on Windows

 
Wellingtonia Tree
Cron as a scheduled task on Windows
 

Hello

I will eventually have more than one Moodle running on my server, so whatever I choose to use has to account for that

I'm on windows server 2016, php 7.2 and IIS 10

I have tried to set up the cron as a scheduled task. - now I've read the bit that says avoid using a browser to run the cron and that I should disable that, so that put me off using the wget option.

So I've been trying the other - as per https://docs.moodle.org/35/en/Cron_with_Windows_OS 

c:\php\php-win.exe -f c:\moodle\admin\cli\cron.php   adjusted to be appropriate to my server.

It fails every time so I tried running the log file output and all it says in the log file is

    off c:\php\php-win.exe -f c:\moodle\admin\cli\cron.php

what is that trying to tell me, I don't understand.

I can actually get the wget version as a batch file to run as a scheduled task, but then I can't tell if it has actually worked because on the moodle site it only says

The cli/cron.php maintenance script has not been run for at least 24 hours - which is correct because I can't make that one work at all.

Am I safe or is it insecure using the wget?

Thank you

Heather

 
Average of ratings: -
Picture of Howard Miller
Re: Cron as a scheduled task on Windows
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

Only answering because nobody else has. I don't know anything about Windows. 

However, I would avoid using the web/wget version if you can. The devs have been threatening to remove this option for a long time. One day they will. 

 
Average of ratings: -
Picture of Usman Asar
Re: Cron as a scheduled task on Windows
Particularly helpful Moodlers

Heather,

in Edit Action window, use the following commands

Program/Script (you can browse to your file as well) --- using your location as example

c:\php\php.exe (not the php-win.exe)

and in add arguments (optional), use this command

-f c:\moodle\admin\cli\cron.php

Also, in general settings tab, do select Run with highest privileges, as well select Run whether user is logged in or not



 
Average of ratings: -
Wellingtonia Tree
Re: Cron as a scheduled task on Windows
 

Hi

thank you.

I've tried and it errors every time. Last run result 0x1 and the history gives operational code (2).

I've checked permissions on the account running the task and I'm sure it is set right, but I've no idea why it isn't working. Read and Execute on the c:\moodle\admin\cli\cron.php, read and execute on c:\php\php.exe

I have tried running the task manually from the command line (different log on account) and it does work, so it is definitely something in the task scheduling that is doing it.

Thanks again.

Heather


 
Average of ratings: -
Wellingtonia Tree
Re: Cron as a scheduled task on Windows
 

Hi

In case anybody else gets this, definitely permissions of some sort. 

At the minute I can only get the task to run when run from a domain admin account which is not a sensible account for running a scheduled task, but at least it proves the scheduled task works so thank you for your suggestion. Just need to work out what the domain has that the task account does not.

Regards

Heather

 
Average of ratings: -