Click to See Complete Forum and Search --> : Cron?
mikeshn
04-09-2003, 10:23 PM
Can someone explain to me why these cron jobs aren't running?
First cront job must run every 45 min and second every 5 min. Nothning happend. Why?
[root@localhost cron]# crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.16136 installed on Wed Apr 9 22:10:23 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
45 * * * * kmail&
5 * * * * ls -la
[root@localhost cron]#
OS: Red Hat 8.0
Thanks
M.S.
GaryJones32
04-09-2003, 11:42 PM
i think you are missing the "user" part
try:
45 * * * * root kmail&
5 * * * * root ls -la
EscapeCharacter
04-10-2003, 12:42 AM
Originally posted by GaryJones32
i think you are missing the "user" part
try:
45 * * * * root kmail&
5 * * * * root ls -la
afaik only the main crontab(/etc/crontab) need the user part
user specific crontabs dont need it since they are run by users.
as for why they arent running maybe crond isnt running. but looking at the second entry how do you know its not running? the output of ls would be going to your mail, are you getting mail?
chrism01
04-10-2003, 06:15 AM
1st, check cron is running:
ps -ef|grep cron
2nd, all cron jobs run in the 'background' ie they have no connection to any terminal, so you won't see any output or prompt. You should get emails, esp if there's a failure.
3rd, 'kmail&' ?? i can't see this working; there's no space between the cmd and '&', not that there's any point in the '&' anyway.
4th, as mentioned ls -la will not produce any output you can see, only into your mailbox, unless you try
ls -la >/home/user/ls.log
or similar.
HTH
scifire
04-10-2003, 01:35 PM
i have the samo problem
for example you type this
1 * * * * echo "Cron working !"
you will not recieve this message every minute not in the terminal if whan to do it you must type "tty " and look the devices whete is output you message
for example if the terminal is /dev/pts/1
echo "Terminal" > /dev/pts/1
you will recieve a message that tell you Terminal
but if run a shell script there is no use of redirecting
if you type in the console
echo "Terminal"
the result is the same
i forgot U are asking about Cron the way u must type this is
1 * * * * kmail &;echo "Mail send">/dev/pts/1
:)
iDxMan
04-11-2003, 12:20 AM
1 * * * * echo "Cron working !"
That will execute every hour on minute 01 - not every minute.
scifire
04-11-2003, 02:57 PM
sorry my mistake :cool:
01 will fix the bug;)
bwkaz
04-11-2003, 05:21 PM
No, 01 * * * * will run, again, on minute 01 of every hour. If you want to run something every minute, you need to use * * * * * instead.
hotleadpdx
04-13-2003, 11:53 AM
One way to check that it's running (in case your e-mail isn't working right) is:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.16136 installed on Wed Apr 9 22:10:23 2003)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
45 * * * * kmail& > /some/placeforlogs/name.log 2>&1
5 * * * * ls -la > /some/placeforlogs/name2.log 2>&1
This will output STDOUT and STDERR to a log file in /some/placeforlogs/name*.log. All of the output of the commands will be sent to the logs so you'll be able to see that kmail& is generating an error message (along the lines of command not found) and ls -la is generating output.