![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What can make Cronjobs stop working?? | Nintendo | UNIX for Dummies Questions & Answers | 0 | 06-04-2008 02:40 PM |
| Delete Duplicate Cronjobs | nskworld | UNIX for Advanced & Expert Users | 2 | 07-20-2007 10:30 AM |
| Time Zone in AIX and cronjobs | run_time_error | AIX | 1 | 04-28-2006 06:42 AM |
| Cronjobs | mcastill66 | AIX | 1 | 05-31-2005 02:15 PM |
| cronjobs | tamer | UNIX for Dummies Questions & Answers | 3 | 01-22-2001 02:48 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Setting cronjobs...
Hi,
We have 4 jobs to be run every month on different times - * a daily job runs once in 2 days at 3PM *a weekly runs every thursday at 3PM * a monthly runs last day of month either 30 or 31st at 3PM * 4th job runs on 3rd of every month at 3Pm How can I set the crontab for these 4 jobs without clash? i,e if a weekly job comes on 3rd then 4th job should take the precedence, and weekly should run the next day.similarly if any other job clashes with job running on month end, the monthly job should take precedence.. looking for suggestions and help... |
|
||||
|
You can run multiple cronjobs at a time without clashing in Unix. Each will run as a background process.
Add this tag at the end of your cron job: >/dev/null 2>&1 Example of your cron job looks like: 30 23 * * * /home/username/www/cgi-bin/members.cgi> /dev/null 2>&1 |
|
||||
|
If not running them at the same time is a requirement, you need to implement some additional logic. Perhaps wrap each of the scripts inside a wrapper which decides whether to run or not, based on your criteria, or based on the existence of a lock file (but then you still need to figure out how to make the correct one run and create the lock file in the first place).
Actually maybe it's easier to have a single cron job which runs a script which decides whether it should run the monthly, weekly etc job. @incredible: what does redirection have with this to do? |
|
||||
|
There may be external factors which force the requirement to not run in parallel. For example, maybe it's a database cleanup job which needs exclusive access to the database, and should run with different parameters on different days.
|
| Sponsored Links | ||
|
|