What does the run-parts mean in crontab?
Hey all, in the following line of a crontab file:
01 * * * * root run-parts /etc/cron.hourly what does the "run-parts" mean? - MT |
it will run every script in that directory.
|
So... if I were to add THIS to crontab:
* * * * * root run-parts /etc/cron.Intranet and then in the directory cron.Intranet I were to create a file called IntranetTasks.cron, which inside of IT had : #!/bin/sh 0 0 1 * * /var/www/cgi-bin/monthlyUpdate.cgi # Runs monthlyUpdate.cgi which creates a new ftpLog file and stores the old one in /var/www/ftpLogs That would work, right? - MT |
Quote:
Just put this in your crontab Code:
# The next line runs monthlyUpdate.cgi which creates a new ftpLog file and stores the old one in /var/www/ftpLogs su - become root crontab -e edit root's crontab to put in those lines exit cease being root |
the point of the runparts is to have a really simple place to drop system scripts that will run hourly, daily, weekly etc.. just from the directory they are dropped in. saves you messing with cron if you don't need to.
|
"Not a directory: /etc/cron.daily" warning
I made some changes in crontab and got an error I will describe, so I removed changes but is has not gone. Fedora3
This is the original crontab that worked fine until I added (then removed) some cron tasks. SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly I am receiving hourly emails "Not a directory: /etc/cron.daily" This dir contains: inn-cron-rnews inn-cron-nntpsend drwxr-xr-x 2 root root 4096 Jul 11 15:38 cron.d drwxr-xr-x 2 root root 4096 Oct 14 10:29 cron.daily -rw-r--r-- 1 root root 0 Oct 14 09:49 cron.deny drwxr-xr-x 2 root root 4096 Oct 14 09:55 cron.hourly drwxr-xr-x 2 root root 4096 Oct 14 09:48 cron.monthly -rw-r--r-- 1 root root 265 Nov 23 03:05 crontab drwxr-xr-x 2 root root 4096 Oct 14 10:29 cron.weekly I've restarted httpd What's wrong? Thanks in advance |
Quote:
Well, "run-parts" is a shell script, and for every directory it is configured to look at it runs this little test condition (which simply tests that the target is in fact a directory): Code:
if [ ! -d $1 ]; then You could remove this test altogether from the script, but still ... |
time65, this thread is ancient... why did you reply to it??
|
I know this thread is ancient but I had this problem and all of my net searches keep bringing me here, in the end Redhat support found the solution.
The cause of my "Not a directory" error was a corupt /etc/crontab file. Deleting the crontab file and re-creating it solved the issue. Appearently, crontab was passing bad info to run-parts. |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Its also the case that system design changes over time, so the answer may not 'work' for the orig qn because the systems are too far apart time-wise.
|
System design changes do change over time, but in this case, it hasn't. And thanks to all the recent comments, this showed up as the first search in Google, and gave me exactly what I was looking for; a brief explanation as to crontab's run-parts. The rest was just pure entertainment.
I am a little disappointed in the tone of the comments of acid_kewpie who, as a moderator, I had hoped would show just a bit more restraint. I, for one, agree with HowitZer, and have never seen the point in closing out old threads when they're still useful. |
All times are GMT -5. The time now is 12:33 PM. |