Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm a relative new comer to Linux, but I'm trying to learn how to use cron jobs. The problem I'm having is that I can't seem to get a job to run at all. I'm running Red Hat Enterprise Linux 4 and I've entered the command:
to install a new job, and then I create the following line in vi:
52 11 * * * root ls /proc >> /home/ma15032/Crontest/log
So all I'm trying to do is write the contents of the /proc directory to the log file at 11:52 this morning. It doesn't look like the job starts at all.
Can anyone offer a suggestion as to why this is?
P.S. I've also checked the cron logs and there is no entry at all around the time I scheduled the job to run.
If you use "crontab -e" you're editing your user crontab (for the user you run it as ... probably root).
If you are editing your user crontab, you don't specify the user it's being run as.
If you're editing the system crontab (/etc/crontab), you would specify the user it's being run as (ie: do what you did). In crontab -e, lose the "root" and you should be a bit more likely to have things work.
The directory does exist and the "log" file gets created when I run it in a terminal. This is a fresh install of RH Enterprise 4, is there anything I would have need to have done to enable cron jobs to run? I've made sure the crond daemon is running, other than that I can't think of anything.
Ok...so I logged onto an ESX server we have in the office and I created a cron job that worked exactly as it should. So I'm very confident it's not my syntax, but rather some config issue with Red Hat. Any suggestions?
I don't have a RHEL4 box to view at the moment. For the hell of it, modify your /etc/crontab again (to run the command, say, 10 minutes in the future) and then run: # restorecon /etc/crontab /usr/sbin/crond
And then: # /etc/init.d/crond restart
Any luck? If not, I am out of ideas for the moment.
Why edit the system crontab file?! When you run 'crontab -e' a per-user crontab file should be installed under /var/spool/cron, even for root. And if the cron daemon is running, it should be executed properly.
While it may be more "proper" form (depending on how you like to do things) to edit a user crontab or simply add a script to one of the /etc/cron.hourly||daily||weekly||monthly directories, I don't see what that has to do with his problem.
Cron searches /var/spool/cron for crontab files which are named after
accounts in /etc/passwd; crontabs found are loaded into memory. Cron
also searches for /etc/crontab and the files in the /etc/cron.d direc-
tory, which are in a different format (see crontab(5)). Cron then
wakes up every minute, examining all stored crontabs, checking each
command to see if it should be run in the current minute.
Cron should still find the entry in /etc/crontab and execute it. Something is borked.