Sunday, July 12, 2009

Enable Crontab

Giving Crontab permission to new os user

Login as root
Goto /etc/cron.d directory
Add the user entry (ex. ota ) in cron.allow file
Note: if cron.allow files doesn't exists then create it

Login as o/s user
Set the editor in .profile or .bash_profile
Example: EDITOR=vi;export EDITOR
Now you can schedule cron jobs.


To setup cronjob
crontab -l( list current jobs in cron)
crontab -e ( edit current jobs in cron)
_1_ _2_ _3_ _4_ _5_ executable_or_job
Where
1 – Minutes (0-59)
2 – Hours ( 0-24)
3 – day of month ( 1- 31 )
4 – Month ( 1-12)
5 – A day of week ( 0- 6 ) 0 -> sunday 1-> monday
e.g. 0 3 * * 6 Means run job at 3AM every saturday
This is useful for scheduling tablespace threshold, ftp, rman backup or removed old log files, or other scripts regularly.
Sample Scheduled backup:
$ crontab –l 
OTA Database:
50
23
*
*
0,2,3,6
/u01/ota/dailyexp_ota.sh
50
23
*
*
1,4
/u01/ota/offbkup_ota.sh
15
14
*
*
0,1,2,3,4,6
/u01/ota/morning_arch.sh






























No comments:

Post a Comment