The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Crontab question blondie2407 HP-UX 12 09-16-2009 01:53 PM
Crontab Question. NycUnxer UNIX for Dummies Questions & Answers 9 11-14-2007 11:53 AM
CRONTAB Question pauls_579 UNIX for Dummies Questions & Answers 2 01-23-2007 05:46 PM
Crontab question *Jess* SUN Solaris 3 07-26-2006 12:19 AM
crontab question steelrose UNIX for Dummies Questions & Answers 5 10-05-2005 12:07 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-25-2008
mojoman mojoman is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 164
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 (permalink)  
Old 11-25-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
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 (permalink)  
Old 11-25-2008
mojoman mojoman is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 164
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 (permalink)  
Old 11-25-2008
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,190
Did you try what Ikon said?

Quote:
Originally Posted by Ikon View Post
Code:
# man crontab
also
Code:
# man cron
  #5 (permalink)  
Old 11-25-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
/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 (permalink)  
Old 11-25-2008
mojoman mojoman is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 164
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 (permalink)  
Old 11-25-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
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
Sponsored Links
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0