Question about crontab file!

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Question about crontab file!
# 1  
Old 10-14-2009
Question about crontab file!

Friends ,

I have the following questions about crontab file :

1) In crontab file I got the folllowing output :
Code:
[root@lpt ~]# cat /etc/crontab
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 know that the file under cron.hourly/daily/weekly are system specific executables file . Then If I want to keep a manual script like (test.sh) into cron.daily and i want it runs at 10:00 am everyday, so I edit the crontab file :
Code:
00 10 * * * root run-parts /etc/cron.daily

But the script(test.sh) is not working .

Now my question , is it not possible to run the manual scirpt (not system specific) using cron.daily or cron.hourly directory ? or it is only used for system specific executables file ? Hope I have to clear my question .

2) What is the function of 'run-parts' command .

3)
In the below crontab line :
Code:
 */5  * * * * /tmp/test.sh

what is meaning of 5 ? it it 5 sec or 5 min


Waiting for ur kind reply ... ...

Last edited by pludi; 10-14-2009 at 04:06 AM.. Reason: code tags, please...
# 2  
Old 10-14-2009
1. It is not system specific: If you do everything right, then it should work.

2. man run-parts : man run-parts(8) - run scripts or programs in a directory by debian Translated by humans

3. That is 5 minutes, man 5 crontab

Code:
 
field          allowed values
-----          --------------
minute         0-59
hour           0-23
day of month   1-31
month          1-12 (or names, see below)
day of week    0-7 (0 or 7 is Sun, or use names)

# 3  
Old 10-14-2009
copy the script to the directory, don't edit the cron.daily configs.

Also, the script may be failing if the environment variables that you are defining are not set in the script. If you run it manually and it works, but does not in cron, that is usually the case.

Also, if you want the script to run at a different interval than the cron.X then just set up a specific cron job for it with crontab -e.

the cron.X files are for anacron to manage your jobs.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question on crontab

Hello, I have scheduled the execution of a file (delete_oldv02) every hour with crontab and it works perfectly. See below the instruction written. 0 */1 * * * /home/delete_oldv02 >>/home/delete_oldv02.log My first question is if I can add one more line to crontab. I also would like to... (5 Replies)
Discussion started by: dcaccount
5 Replies

2. Shell Programming and Scripting

crontab question

If I want to run a process every 30 mins except for 3-4 where I want to run every 5 mins I know I can do this with 3 entries. 30 5-23 * * * "echo "Hello" 30 0-3 * * * "echo "Hello" 5,10,15,20,25,30,35,40,45,50,55 3-4, * * * "echo Hello" Can this be done with less entries (4 Replies)
Discussion started by: BeefStu
4 Replies

3. Shell Programming and Scripting

crontab question

I have a user (xxx) who is allowed to run cron jobs when a job is launched from cron is the .profile sourced in? I am not sure it is so I setup a cron job as this user to do the following: 35 15 * * 0-5 su - xxx -c "ksh ls -lt /tmp" > /tmp.out and I am seeing the following error (see... (2 Replies)
Discussion started by: BeefStu
2 Replies

4. UNIX for Dummies Questions & Answers

Question about crontab

Hello guys, I have a server with Red Hat Enterprise Linux AS release 4 (Nahant Update 5), there i have a lot of users, im the root. I need to lock the use of crontab to the users, i mean, i dont want to give to the users the option to creat any crontab line, how can i do that? I tried to... (4 Replies)
Discussion started by: lestat_ecuador
4 Replies

5. AIX

How-to crontab question

My question is how to specify the one-time execution of a shell script in crontab? For example: If I wanted to schedule shell "Test.sh" for one-time execution on December 13 at 8:00AM would it be as follows? 00 08 13 12 6 /usr/datatools/dtbackups/Test.sh > /usr/u/sybase_12.5/logs/Test.log &... (3 Replies)
Discussion started by: Alan.AIX
3 Replies

6. UNIX for Dummies Questions & Answers

CRONTAB Question

Hello, When I do a crontab -l I get the following listing: # crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.13826 installed on Thu Jun 23 10:13:18 2005) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) #0 1 * * * scp... (6 Replies)
Discussion started by: mojoman
6 Replies

7. UNIX for Dummies Questions & Answers

Crontab Question.

I set up a job to run a script in a certain directory to remove certain files. The script seems to run as my logs indicate but nothing happens. If I run the script manually then it removes the correct files. I'm now wondering if crontab doesnt have access to remove files from the directory I'm... (9 Replies)
Discussion started by: NycUnxer
9 Replies

8. Shell Programming and Scripting

Crontab question

Hello, Does anybody know of a way to add an entry to the crontab without executing >crontab -e? I'm running a script that would add a line without any user intervention. The only way I could think of would to use sed to add the line to the end of the cron file, but I don't know if this would... (3 Replies)
Discussion started by: ctcuser
3 Replies

9. UNIX for Dummies Questions & Answers

crontab question

Why does this cron entry do nothing? It works interactively. 58 23 * * * mydate=`date '+%Y%m%d'`;mv /opt/home/user/file /opt/home/user/file_$mydate (5 Replies)
Discussion started by: steelrose
5 Replies

10. UNIX for Dummies Questions & Answers

crontab question

I'm trying to create a crontab entry that will run the who command once per hour Monday-Friday. Any command output should be appended to the file whoison.log in my home directory. This is what I wrote: crontab 0 * * * 1-5 who >> /home/myhome/whoison.log Did I do this right? Thanks (7 Replies)
Discussion started by: Relykk
7 Replies
Login or Register to Ask a Question