CRONTAB Question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers CRONTAB Question
# 1  
Old 11-25-2008
CRONTAB Question

Hello,

When I do a crontab -l I get the following listing:

[root@mail-02 cron.daily]# 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 /tmp/ypfile2 creek://tmp
59 20 * * 1,2,3,4,5 /backup/mail-02_sda3.sh >/tmp/dumplog_nst2.log 2>&1
59 20 * * 1,2,3,4,5 /backup/mail-02_sdb1.sh >/tmp/dumplog_nst1.log 2>&1
#45 18 * * 1,2,3,4,5,6 /root/dump.sh >/tmp/dumplog.txt 2>&1
#00 10 * * 1,2,3,4,5 /root/dump2.sh >/tmp/dumplog2.txt 2>&1
30 14 * * 1,2,3,4,5 /root/crons/UsersList.pl >/dev/null 2>&1
#05 9 * * * /root/crons/du_file.sh >/tmp/du_errors.txt || mail -s "du_file.sh didn't run" root@swi.com < /tmp/du_errors.txt
0 8 * * * /root/crons/etcBack.sh >/dev/null 2>&1
30 11 * * * /bin/chown -R pavisit:users /home/pavisit/ >> /var/log/messages
00 21 * * 1,2,3,4,5 /backup/dmzback > /backup/logs/backup.log 2>&1
00 9,21 * * 0,1,2,3,4,5,6 /usr/sbin/ntpdate 205.150.86.60 > /dev/null 2>&1
0 * * * * /root/clean_post

When I go to /etc/crontab I just see:

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 have looked for other crontabs but cannot find any. What file is crontab -l listing? And I am logged in as root when I ran crontab and checked /etc/crontab.
# 2  
Old 11-25-2008
To edit do a
Code:
crontab -e

The actual files are at:

/var/spool/cron

BUT you are not supposed to edit the files directly. Use crontab -e

For more info:
Code:
# man crontab

# 3  
Old 11-25-2008
So what are the files in /etc/crontab

So what is /etc/crontab for?

When I do crontab -e I see completely different information than I do for /etc/crontab.
# 4  
Old 11-25-2008
Did you try what Ikon said?

Quote:
Originally Posted by Ikon
Code:
# man crontab

also
Code:
# man cron

# 5  
Old 11-25-2008
/etc/crontab is system crontabs file. Usually only used by root user or daemons to configure system wide jobs. All individual user must must use crontab command to install and edit their jobs as described above. /var/spool/cron/ or /var/cron/tabs/ is directory for personal user crontab files. It must be backup with users home directory.

Additionally, cron reads the files in /etc/cron.d/ directory. Usually system daemon such as sa-update or sysstat places their cronjob here. As a root user or superuser you can use following directories to configure cronjobs. You can directly drop your scripts here. run-parts command run scripts or programs in a directory via /etc/crontab

Directory Description
/etc/cron.d/ Put all scripts here and call them from /etc/crontab file.
/etc/cron.daily/ Run all scripts once a day
/etc/cron.hourly/ Run all scripts once an hour
/etc/cron.monthly/ Run all scripts once a month
/etc/cron.weekly/ Run all scripts once a week
# 6  
Old 11-25-2008
Cron.daily

So if I put a script in /etc/cron.daily it wil run according to how scipts are configured to run for cron.daily in /etc/crontab right?
# 7  
Old 11-25-2008
Yes, if you put a script in /etc/cron.daily it will run everyday at 04:02am, assuming your script is correctly written. Just because it runs from the shell prompt does NOT mean it will run from cron. You will have to search the forum(s) for specifics.

Remember the following are VERY helpful:
1) The search function on this website
2) man pages
3) google search
 
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

I need to run an script every 10th and 25th day in every month at 11pm. the script name is /home/ss/automated.sh I tried to execute the script every day and everytime with the below syntax. its not executing it from crontab. * * * * * /home/ss/automated.sh Any idea why it not... (6 Replies)
Discussion started by: ramkumar15
6 Replies

3. UNIX for Dummies Questions & Answers

Another crontab question

Hey out there This is all I have in my crontab file. I know the crontab works because it was already out there and working. I simply replaced the existing with my line of code below to see if it worked. I uploaded 6 month old pdf files in this directory, stopped/started all the scripts that... (3 Replies)
Discussion started by: vsekvsek
3 Replies

4. 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

5. HP-UX

Crontab question

Please cna you tell me if the following command entered in error would affect the crontab file crontab -e | more Thanks :) (12 Replies)
Discussion started by: blondie2407
12 Replies

6. 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

7. 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

8. 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

9. Solaris

Crontab question

HI all, I would want to schedule a job to run every 2 weeks. In the mean time, i'm only able to schedule on every week. Is it possible to schedule 2 weeks on crontab? Thank you. (3 Replies)
Discussion started by: *Jess*
3 Replies

10. 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
Login or Register to Ask a Question