Solved

UNIX/Linux - CRON Question..

Posted on 2014-04-22
3
735 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, EE MVE
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

803 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