General help

crontab -e for FEDORA as root HOW TO

Picture of Pubudu Premachandra
crontab -e for FEDORA as root HOW TO
I have installed moodle on fedora core 4 successfully but when I log in to the system moodle shows me that I am a Online user but in Upper left corner it shows that you are not loggin.

Is this due to cron not calling cron.php coorectly?? I think that's the problem
I gave this command while I am root to the fedora Operating System.
In Coomand promt --> corntab -e  
*/1 * * * * wget -q -O /dev/null http://localhost/moodle/admin/cron.php (copied and pasted from Redhat installation guide in moodle site.)
then shell tells no crontab installing for root. and it seems to install cron job for root. (in moodle site Redhat installation guide tell run crontab -e  program as a other user not as root.)

Is this cron job process correct?? Or how to overcome this? Any other way to set up cron task while remain as root??

Thank you,

Average of ratings: -
Picture of Thomas Robb
Re: crontab -e for FEDORA as root HOW TO
Core developers

First, I hope that you entered "crontab -e...." not "corntab -e...." since only the former will work.

Second, concerning crontab and loggin in, there is no connection between the two at all.  If your moodle has two slightly different domain names, say one with "www." and one without then moodle will not be able to find the cookie that says that you are logged in.  Look at your domain name BEFORE you log in and then look again afterwards.  Are they the same?

Average of ratings: -
Picture of Pubudu Premachandra
Re: crontab -e for FEDORA as root HOW TO
O.k I come up with loggin problem successfully still my cron seems not to be working correctly.

Yes I entered corntab -e correctly
and in vi page given I copied and paste from moodle installation guide for redhat linux (my OS is fedora core 4 remaining as root user).
*/5 * * * * /usr/bin/wget -g -0 /dev/null http://localhost/moodle/admin/cron.php
(I'm sure I entered correclty. )

1)So I need to whether I set up the cron task correctly. Is there way of cheking it???Please let me know

 I took this action to see whether it working or not bu seeing mail messages for errors.(why that /dev/null   tell me it's need )

with command tail -50 /var/spool/mail/root

From: root@localhost.localdomain (Cron Daemon)
To: root@localhost.localdomain
Subject: Cron <root@localhost> /usr/bin/wget -g -O /dev/null http://localhost/moodle/admin/cron.php
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

wget: glob: Invalid boolean `-O', use `on' or `off'

2)now Is that o (or 'o') or 0(zero). ???(Do my options are coorect like -g -0).

3) Why need cron? Without it what would happen? cron set for a 24 hours, is it good for a 2000 student site.???

Average of ratings: -
Picture of Markus Översti
Re: crontab -e for FEDORA as root HOW TO
  1. You can copypaste command to commandline, ie. copypaste /usr/bin/wget -g -0 /dev/null http://localhost/moodle/admin/cron.php to commandline and press enter
  2. It is an letter O, not number 0
  3. You need cron to periodic commands (like emailing students, back-ups etc)

Average of ratings: -
Picture of Pubudu Premachandra
Re: crontab -e for FEDORA as root HOW TO
Hello Markus Översti

Today I tried with
 wget -q -0 /dev/null http://localhost/moodle/admin/cron.php

Note that q(which I found in moodle installation guides too.) instead of -g it seems to be working. No mails means that the cron setup is success? or not??

1)What is the correct command?
2)how i know it's working correctly? Any way testing?

Average of ratings: -
Picture of Markus Översti
Re: crontab -e for FEDORA as root HOW TO

If it doesn't work, then you'll get red error texts on admin-page.

For finding out, if it really works, you can trace yours logfiles. In Debian (I don't have any access to Fedora atm) you can do

tail -f /var/log/httpd/access.log |grep cron

so you see from yours server logs, when cron-page is accessed. If you get a new line every 5. minutes, then it works fine. Or you can see

cat /var/log/httpd/access.log |grep cron

from old logs, if cron-page is accessed.

Average of ratings: -
Picture of Gavin McCullagh
Re: crontab -e for FEDORA as root HOW TO

You are, I imagine dropping the output by "-O /dev/null" .  However, your post has a zero (0) not a capital-O (O) which would not work.  This may be a typo.

If you want to see the output you either change to:

wget -q -O /tmp/moodlecron.out http://localhost/moodle/admin/cron.php

and look at the file, or to get an email log:

wget -q http://localhost/moodle/admin/cron.php


Average of ratings: -
Picture of ztechguy Z
Re: crontab -e for FEDORA as root HOW TO
I have had a moodle setup running for about six months and have the crontab -e setup
*/5 * * * * wget -q -O /dev/null
I am finding a lot of cron outputs in my root folder, and they are building by the day.  How do I get rid of these in the most efficient manner. 


Average of ratings: -
Picture of Mohammad Hatamleh
Re: crontab -e for FEDORA as root HOW TO


what i found that in Fedora you must do the following:

crontab -e


*/1 * * * * wget -q -O /dev/null http://localhost/moodle/admin/cron.php

Note: The crontab will be work in fedora if you use the second line

Average of ratings: -