Solved

UNIX/Linux - CRON Question..

Posted on 2014-04-22
3
717 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 27

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.

743 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

13 Experts available now in Live!

Get 1:1 Help Now