Linux - Newbie This 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! |
| Notices |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
11-11-2005, 09:34 AM
|
#1
|
|
LQ Newbie
Registered: Nov 2005
Location: Philadelphia, Pa
Posts: 7
Rep:
|
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
|
|
|
|
11-11-2005, 09:51 AM
|
#2
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
it will run every script in that directory.
|
|
|
|
11-11-2005, 10:06 AM
|
#3
|
|
LQ Newbie
Registered: Nov 2005
Location: Philadelphia, Pa
Posts: 7
Original Poster
Rep:
|
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
|
|
|
|
11-11-2005, 11:41 AM
|
#4
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
No. It is simpler than that:
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
0 0 1 * * /var/www/cgi-bin/monthlyUpdate.cgi
If you are putting this into your own crontab, then it might not work as maybe you as a user do not have the permission(s) needed to run that program. If that is the case, put those lines of code into root's crontab:
su - become root
crontab -e edit root's crontab to put in those lines
exit cease being root
|
|
|
|
11-11-2005, 12:31 PM
|
#5
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
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.
|
|
|
|
11-22-2005, 03:11 PM
|
#6
|
|
Member
Registered: Oct 2005
Location: Uruguay
Distribution: CentOS 5.6 Ubuntu 12.4 MacOS 10.6
Posts: 107
Rep:
|
"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
Last edited by marciano; 11-22-2005 at 03:13 PM.
|
|
|
|
03-06-2008, 05:53 PM
|
#7
|
|
LQ Newbie
Registered: Mar 2008
Posts: 1
Rep:
|
Quote:
Originally Posted by marciano
I made some changes in crontab and got an error I will describe, so I removed changes but is has not gone. Fedora3
[snip]
I am receiving hourly emails
"Not a directory: /etc/cron.daily"
[snip]
What's wrong?
Thanks in advance
|
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
echo "Not a directory: $1"
exit 1
fi
For some reason the shell is failing this test even though it is in fact a directory. I have the same problem and have never found any rhyme or reason to it; it happens on some systems, not on others, etc.
You could remove this test altogether from the script, but still ...
|
|
|
|
03-07-2008, 03:29 AM
|
#8
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
time65, this thread is ancient... why did you reply to it??
|
|
|
|
11-14-2008, 01:10 PM
|
#9
|
|
LQ Newbie
Registered: Nov 2008
Location: Southern Maine
Distribution: RHEL 5
Posts: 1
Rep:
|
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.
|
|
|
|
03-02-2012, 11:39 AM
|
#10
|
|
LQ Newbie
Registered: Mar 2007
Distribution: Fedora Core 6, Fedora Core 4
Posts: 22
Rep:
|
Quote:
Originally Posted by acid_kewpie
time65, this thread is ancient... why did you reply to it??
|
The real question is what is wrong with discussing something at any time? Why does it matter if the thread is years old? Google search will still find the thread even if it's 10 years old.
|
|
|
|
03-02-2012, 12:20 PM
|
#11
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
Quote:
Originally Posted by HowitZer
The real question is what is wrong with discussing something at any time? Why does it matter if the thread is years old? Google search will still find the thread even if it's 10 years old.
|
Because it's REALLY confusing. People end up wasting a LOT of time by trying to answer questions without realising they were answered YEARS AGO as someone needlessly resurrected a thread. That's why. Also most people literally add NO benefit whatsoever by replying. Like you. This thread was dead for a further 4 years, and you dragged it up for no reason. It's almost as if you did it as a joke, or worse...
Last edited by acid_kewpie; 03-02-2012 at 12:23 PM.
|
|
|
|
03-03-2012, 12:41 PM
|
#12
|
|
LQ Newbie
Registered: Mar 2007
Distribution: Fedora Core 6, Fedora Core 4
Posts: 22
Rep:
|
Quote:
Originally Posted by acid_kewpie
Because it's REALLY confusing. People end up wasting a LOT of time by trying to answer questions without realising they were answered YEARS AGO as someone needlessly resurrected a thread. That's why. Also most people literally add NO benefit whatsoever by replying. Like you. This thread was dead for a further 4 years, and you dragged it up for no reason. It's almost as if you did it as a joke, or worse...
|
Two answers are better than one. It gives the reader increased confirmation they are being steered in the right direction and gives two perspectives.
|
|
|
|
03-03-2012, 03:49 PM
|
#13
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
Quote:
Originally Posted by HowitZer
Two answers are better than one. It gives the reader increased confirmation they are being steered in the right direction and gives two perspectives.
|
yes, but you gave zero answers. twice.
|
|
|
1 members found this post helpful.
|
03-04-2012, 08:21 PM
|
#14
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 14,953
|
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.
|
|
|
|
04-27-2012, 03:48 PM
|
#15
|
|
LQ Newbie
Registered: Apr 2012
Posts: 1
Rep: 
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:31 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|