|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Cron Job Config files
Hi All,
I have created 2 shell scripts and set Cron jobs which runs it at various frequencies.The first one which runs every 2 minutes Monday to Friday and another cron job runs at 11PM on the last Sunday of every month. I have given the cron job entries below. Was wondering whether instead hard coding the parameter values meant for the shell script in the crontab whether it was ok to set them as unix level environment variable or something and then use them instead in the cron job. I think it will make the cron job make cleaner as well as more easily manageable. My DBA says to use a “config” file to contain all the parameters that I need to pass on to the script What are your thoughts on this?.If I have to go the config file way, what do i need to do as i have don't know much about creating/updating config files... #====================================================================================== # CRON JOB FOR RUNNING THE SHELL SCRIPTS #====================================================================================== # ------------- minute (0 - 59) # | ----------- hour (0 - 23) # | | --------- day of month (1 - 31) # | | | ------- month (1 - 12) # | | | | ----- day of week (0 - 6) (Sunday=0) # | | | | | */2 * * * 1-5 sh SHELL1.ksh <PARAM1> <PARAM2> <PARAM3> <PARAM4> <PARAM5> <PARAM6> <PARAM7> <PARAM8> <PARAM9> <PARAM10> <PARAM11> 23 * * * 0 [`date "+%d"` -gt 24] && sh SHELL2.ksh <PARAM1> <PARAM2> <PARAM3> <PARAM4> <PARAM5> <PARAM6> <PARAM7> <PARAM8> <PARAM9> <PARAM10> <PARAM11> |
| Sponsored Links |
|
|
|
|||
|
Quote:
Hi, thanks for the reply.I see what you are saying.But my issue is slightly different.My shell script takes 11 params and the shell script is run as a cron job.So instead of hard coding the values of the 11 parameters in the crontab file is there a way out to refer then from a file or something?..similar to the one you told me...such as setting the parameter values in the a cfg file and referring them in the crontab? Thanks |
|
|||
|
Ok.I have placed all the paremeters as variables in a filecalled as CONFIG.cfg and assigned them the relevant values.
Then I have added this portion to the top of my crontab #! . /path/CONFIG.cfg But my cron does'nt seem to run..I am very new to Unix so please bear my ignorance |
|
|||
|
Hi,
thanks very much and it worked. Now another question: How do I migrate this crontab of mine across various environments? My colleague says it has to be manually typed into various unix boxes.Can't we have a script/file that we can install or place in a certain path so that we can eliminate manual typing of crontab entries? Thanks V |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reuters Config Files - Where do they go? | Linux Bot | Complex Event Processing RSS News | 0 | 11-14-2008 04:50 PM |
| bash: cron-config: command not found - PLEASE HELP ME!! | sriya | UNIX for Dummies Questions & Answers | 2 | 10-14-2008 06:37 PM |
| Config Files | toddjameslane | HP-UX | 0 | 05-19-2005 10:53 AM |
| Apache Config Files | Webwitch | UNIX for Dummies Questions & Answers | 1 | 08-01-2001 04:35 PM |
| new LAN, where are the config files? | softarch | UNIX for Dummies Questions & Answers | 3 | 03-27-2001 03:36 PM |