Hi again fellow Moodlers,
I'm hoping someone here can shed light on exactly the issue I'm experiencing here at the moment. Little background:
I migrated our INTERNAL Moodle site (v 3.6.2 (Build: 20190114)) to our LIVE load balanced servers with a single DB server & moodledata location, with a little help from you fine people I must add). At first i was receiving the same error as I am here:
Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.
Which turned out to be permissions related in IIS.
Now that I have the site running successfully I noticed the message relating to 'cron jobs not being ran in last 24hrs' etc. After looking through the forums I found a few posts that helped me piece together a *.bat file to run under Task Scheduler in Windows.
I have successfully managed to get this running on the INTERNAL environment but when I moved this to the LIVE environment, changed the paths/locations etc. I get the same error when setting up initially (above).
I am unsure where this is coming from? doesn't the cron.php scripts use the same config.php file? I am led to believe by my ISP that the credentials applied to the task in task scheduler is the same user applied to IIS when this issue occurred originally?!
Is this definitely an issue with the user running the cron task in scheduler or can it be something else? I thought I better ask before I tell my ISP they have setup the user/credentials incorrectly
Batch file used:
:: set folder path
:: Create a folder with today's date
if not exist %log_path%\%folder% (
for /f "tokens=1,2,3 delims=: " %%G in ('time/t') do (
if /i "%%I"=="PM" (
set /a _hr = %%G + 12
if %%G==12 set _hr=12
) else (
if %%G==12 set _hr=00
:: Now run the Moodle cron.php script and log the output to the current hours' log file.
C:\php\v7.2.13\php.exe -f C:\inetpub\moodle\admin\cli\cron.php >> %log_path%\%folder%\%date:~6,4%%date:~3,2%%date:~0,2%-%_hr:~-2%.log
:: set min age of files and folders to delete
:: remove files from %log_path%
forfiles -p %log_path% -m *.* -d -%max_days% -c "cmd /c del /q @path"
:: remove sub directories from %log_path%
forfiles -p %log_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path"
This is the same batch file used INTERNALLY, with the paths altered for LIVE. The error message stated is being appended to the logfile created so I'm assuming its an issue with the line executing the cron.php task??
Any help would be greatly appreciated.