LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   can not run cron (https://www.linuxquestions.org/questions/red-hat-31/can-not-run-cron-661375/)

ankitsagwekar 08-08-2008 05:30 AM

can not run cron
 
i m nood last week install rhel 5.2
i want to know how to use crontab so i do this
crontab -e (from root )

type
Quote:

5 * * * * date
but i not get display of date after 5min

colucix 08-08-2008 05:57 AM

Where do you expect it is displayed? Crontab does not allocate a pseudo-terminal and all the standard output and standard error is sent to the system mail by default, unless you explicitly redirect them to a file (or to /dev/null). Check the root's mail: most likely you have tons of mails with the standard output from the cron jobs.

unSpawn 08-08-2008 06:02 AM

Quote:

Originally Posted by ankitsagwekar (Post 3240750)
i want to know how to use crontab so i do this crontab -e (from root )

And if you want to test out stuff, next time please use your personal unprivileged account for that, unless you know the test requires root rights.

arava_sandeep 08-08-2008 06:27 AM

problem cron not working
 
Quote:

Originally Posted by ankitsagwekar (Post 3240750)
i m nood last week install rhel 5.2
i want to know how to use crontab so i do this
crontab -e (from root )

type

but i not get display of date after 5min

hi
i got ur problem
that ur testing cron
u may miss chkconfig crond on and service crond restart
if still problem verfy the ancron

ankitsagwekar 08-08-2008 07:10 AM

i check root mail by typing

Quote:

tail /var/spool/mail/root
but not found any mail ?

i also try
Quote:

2 * * * * date > /date

colucix 08-08-2008 07:26 AM

The correct way to look at mail would be simply
Code:

mail
being logged as root in your case. Anyway, have you tried to redirect the output of the date command to a file, to test if crontab works? Is the cron daemon running?

ankitsagwekar 08-08-2008 07:44 AM

Quote:

Originally Posted by colucix (Post 3240822)
have you tried to redirect the output of the date command to a file, to test if crontab works? Is the cron daemon running?

yes look my second quote on second post

colucix 08-09-2008 03:43 PM

I re-read your first post and I noticed that you stated
Quote:

but i not get display of date after 5min
well... with your crontab entry most likely you don't get the output after 5 minutes, but at 5 minutes of the next hours, for example at 6:05, 7:05, 8:05 and so on. If you really want to run the cron job every 5 minutes you can use the syntax
Code:

*/5 * * * * date
This is the same as specifying all the 5 minutes steps: 0,5,10,15,20,25,30,35,40,45,50,55. Maybe this is what you were looking for. See man 5 crontab for future reference.

chrism01 08-09-2008 08:23 PM

Here's a more user-friendly guide: http://www.adminschoice.com/docs/cro...Crontab%20file

ankitsagwekar 08-11-2008 02:27 AM

thanks
 
thanks dude u solve my problem :)

thread is closed now


All times are GMT -5. The time now is 01:55 PM.