Solved

UNIX/Linux - CRON Question..

Posted on 2014-04-22
3
728 Views
Last Modified: 2014-04-22
If I want to run a script oracheck.sh every 10 minutes I can edit my crontab using "crontab -r"
0,10,20,30,40,50 * * * * /opt/oracle/bin/oracheck.sh

But can I create a file in /etc/cron.d called oracheck and have this
# cat /etc/cron.d/oracheck

Does the file in cron.d work the same way ...??? if not how can this be interpreted in /etc/cron.d ..???

Thanks..
0
Comment
Question by:prav83
3 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 300 total points
ID: 40015910
The content of the files under /etc/cron.d must adhere to the system crontab syntax (/etc/crontab) which means that the 6th column must contain a username under whose credentials the command should be executed. Columns 1-5  are of the same format as in any user crontab.

In fact, the files under /etc/cron.d are treated as extensions of /etc/crontab.

You must be root to edit/create such a crontab file.

0,10,20,30,40,50 * * * * oracleuser /opt/oracle/bin/oracheck.sh
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 40015915
On your first remark: crontab -r removes your crontab entry, with crontab -e you edit your crontab file. As which user do you want the script to run?
0
 
LVL 28

Assisted Solution

by:serialband
serialband earned 200 total points
ID: 40015920
If you put it in /etc/ there's an extra entry for the user to run it as
*/10 * * * * oracle /opt/oracle/bin/oracheck.sh

Depending on your linux distro, you could have one or more of the following.
 /etc/cron.d ---> used by packages
 /etc/cron.daily
 /etc/cron.hourly
 /etc/cron.monththy
 /etc/crontab

 /var/spool/cron/crontabs ---> user crontab
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now