Solved

UNIX/Linux - CRON Question..

Posted on 2014-04-22
3
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 38

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 29

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

740 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