Is this possible? execute the cron.php from remote server on local server?

Is this possible? execute the cron.php from remote server on local server?

by Jerry Lau -
Number of replies: 4

Hello everyone.

My webhost does not allow crons to be executed for their shared hosting plan.

Too late as I've signed on with them LOL

is it possible to have our own PHP/Linux server (on premise) and then on our server, we call our moodle webhost's cron.php file?

for example our server is called "localserver" and our webhost's name is "birdcage"

on localserver, we say


**** /our/php/path/php  birdcage.site.com/admin/cli/cron.php

does that work or do we have to use curl or wget from what my limited understanding is?

Examples would be appreciated and what setup do we need to do to enable this to work at our local and webhost servers?

Thanks!





Average of ratings: -
In reply to Jerry Lau

Re: Is this possible? execute the cron.php from remote server on local server?

by Jerry Lau -
Can I do this on the localserver's cron

wget -O - http://example.com/cron.php >/dev/null
In reply to Jerry Lau

Re: Is this possible? execute the cron.php from remote server on local server?

by Jerry Lau -
or what would happen if they do not allow the cron to be able to run via a "web" page url?

options? not only for this moodle but as a general question.. if a script does tasks that are needed for a regular period and the script is only executed via cron and not so much as "page", would the wget method still work even though the url it fetches looks like it is a "web page"?

Thanks

Dave
In reply to Jerry Lau

Re: Is this possible? execute the cron.php from remote server on local server?

by Jerry Lau -
or this?

1 1 * * 0 /usr/bin/curl -m 120 -s https://otherserver.example.com/some.php &>/dev/null
In reply to Jerry Lau

Re: Is this possible? execute the cron.php from remote server on local server?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
If web based, then https://docs.moodle.org/310/en/Cron#The_web_based_Moodle_cron_command.

Your example above is a guess, I believe. Running cron.php once a week (1 1 * * 0) is not enough!

The CLI command https://docs.moodle.org/en/Cron#Working_out_the_Moodle_cron_command is much more efficient and is the preferred method. If your host gives you shell over SSH, the syntax is 'ssh remoteuser@remotehost command'. But there are many obstacles. The main one being, whether the remote user is equivalent to the owner of the web server process. That is what Moodle expects.

Either way, running a full PC so that you run Moodle on a highly limited USD 4 host rather than spending USD 10 for a decent one, is an environmental crime.