Google it ....

Showing posts with label schedule in cron in linux. Show all posts
Showing posts with label schedule in cron in linux. Show all posts

Sunday, November 8, 2020

You (oracle) are not allowed to use this program (crontab)

 On one of our server we are trying to schedule some os script in cron but appears oracle user can't do that:


$ crontab -l
You (oracle) are not allowed to use this program (crontab)
See crontab(1) for more information

Solution :
This error is due to oracle don’t have access to crontab.
There are two files on server, to allow and deny access to crontab, Files are named as etc/cron.allow and /etc/cron.deny
check that if oracle user is present in cron.deny file. if it is present remove oracle user from cron.deny file and add oracle user to cron.allow file.
if the files "/etc/cron.allow" and "/etc/cron.deny" files are not present on server, we can create both files manually.
# cat /etc/cron.allow
root

So, I haved added oracle user to cron.allow file, file will look as follows:
# cat /etc/cron.allow
root
oracle

Now Oracle user able to access the crontab.
$ crontab -l
no crontab for oracle

Friday, June 8, 2012

How to use crontab in linux

Cron is the time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration.
crontab commands:
crontab -e      Edit your crontab file, or create one if it doesn’t already exist.
crontab -l      Display your crontab file.
crontab -r      Remove your crontab file.
crontab -v      Display the last time you edited your crontab file. 
                (This option is only available on a few systems.)

A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

examples:
min  hour  day/month    month    day/week  Execution time
30  0  1      1,6,12  *  – 00:30 Hrs  on 1st of Jan, June & Dec.
0  20  *        10       1-5  – 8.00 PM every weekday (Mon-Fri) only in Oct.
0  0  1,10,15       *  *  – midnight on 1st ,10th & 15th of month
5,10  0  10        *  1  – At 12.05,12.10 every Monday & on 10th of every month

create a cron job:
su - oracle
crontab -e
--add the following line :
00 13 * * * /u01/scripts/Incr0.sh

this script will run at 1:00 PM everyday.

after edit crontab file reload cron service
su - 
service crond reload

that's all. :)