Cron - which unix command is correct

Cron - which unix command is correct

Mike Shields -
回帖数:6

when I checked my cron - which use to work it was

wget -q -O /dev/null 'http://example.com/moodle/admin/cron.php'

note the ' before and after the url

where as http://moodle.org/doc/?file=install.html#cron states it without

wget -q -O /dev/null http://example.com/moodle/admin/cron.php

either way none of these are working... I have set up a test lesson to try to automate emails - but am having no luck...

Any suggestions - please..

Mike

回复Mike Shields

Re: Cron - which unix command is correct

Michael Penney -
Hi Mike, we had to use curl instead of wget on our Red Had Enterprise server, maybe try that.

But I'm confused, you set up a test forum, not lesson, right? I don't think there are any automated emails sent out from a lesson.


回复Michael Penney

Re: Cron - which unix command is correct

Mike Shields -

Hi Michael,

I tried the curl instead of the wget - now every 5 minutes I get a message saying "curl: (3) <url> malformed" - is this right???

Thanks,

Mike.

回复Mike Shields

Re: Cron - which unix command is correct

Jason Hando -
I realise this is a months old thread but I have just spent some hours getting crons to work on my remote host (after changing hosts and it going awol) and can answer this question hopefully for others to save time....

what worked:
1. cpanel cron job using advanced (unix style)
2. 15,30,45,59 in the minute box
3. * in the other boxes - hour, day, etc
4. /usr/bin/curl -q -O http://example.com/moodle/admin/cron.php in the command box
5. cron@example.com in the email box.... this will send an email every 15 minutes so will want to be an email acct you only use for cron.... I couldn't get email to be trashed using /dev/null

what didn't work:
1. using /dev/null in the cron command, this caused a malformed url error
2. using wget or lynx as was suggested in moodle install documentation, this caused a permission error, suggesting that wget was locked by hosting provider


Hope this helps,

Jason
回复Mike Shields

Re: Cron - which unix command is correct

Bill Burgos -
Hello Mike,

As far as I know, wget will work without the single quotes. So, your syntax should be correct.

You have not indicated if you are using a hosting service or not. Some, I have heard, have disabled the wget function.

If you are using a hosting service and wget or curl is disabled, you can ask them to set up a cron tab for you with the specifications you need, They are usually O.K. with this request.

You also might check if your smtp settings are O.K. and that you are getting backup files if they are specified in your settings.

Also, as Michael suggested. Lesson does not seem to have a cron function at this time. You may want to post to a forum on your site to see if it is working.
回复Bill Burgos

Re: Cron - which unix command is correct

Mike Shields -

Thanks Michael & Bill,

Sorry I meant I set up a test course blush

My server is http://www.nomonthlyfees.com/ - I set up the cron when I first started using moodle (some 18 months a go) through cpanel... I have sent a request to my hosting service to see if they can identify the problem as it used to work.

Not to sure if my smtp settings are correct - the smtphosts box is blank!!, although I have info in the smtpuser, smtppass & noreplyaddress boxes.

Thanks for the tips so far...

thoughtful I did find that visiting the link http://example.com/moodle/admin/cron.php actually made the cron work.. howver the time time I attempted it - it didn't...

Is there anything else to try??

Mike.

回复Mike Shields

Re: Cron - which unix command is correct

Tim Allen -
Hi Mike,

I'm not sure what the problem is, but you might try deleting the smtppass and smtpuser fields, because I think they are useless unless you have also filled in the smtphost field.

It may not help, but give it a shot, you never know...thoughtful

Also, I seem to remember from when I used cpanel that you can configure to have an email sent showing the cron output (checks...yes, see the screen shot below).  If you do this the email info may help you locate where the problem is.

Just a couple of thoughts. 

Tim.  smile 
附件 cron_cpanel.png