cron_job

I have a job now that is schedule to run every 5 minutes. It simply rns a batch program in perl.
What i want is to stop the cron when the database has a downtime record scheduled.

If system is scheduled to go down on weekend then I want cron to stop during that time. I am thinking that unix now does not see the database records and it should nto matter. the only way is to re-schedule the cron using the batch prgoram which read the db data and then decides when to cron.

- when you want to maintain your database and bring it down, create the file /path/to/dontrun (either by hand or by script that is bringing the database down)
- the crontab job schedule to run every 5 min will remain the same, but the job script should have the added logic I gave at the script beginning. So, when the script run every 5 min and find the file it will exit otherwise run.
- when the database maintenance is over, remove the file /path/to/dontrun, either manually or by script.

0

sam15Author Commented: 2008-10-14

Oh i see, but there is some manual work involved here.

The downtime is defined in the DB table on a different server. this requires somehow the DB to create/ftp th file from server A to server B where the cron job runs and then delete it somehow.
it is not easy to do.

Yes but if you want the crontab to know the down time from a database then you need the script to connect to the database and query the timing - which requires the the database to be up and a database client to connect to the remote database. If you use oracle database then you may use tnsping which comes with oracle client to test database being up or down

0

sam15Author Commented: 2008-10-14

well the perl batch program is doing this: query the DB usnig http call and get a record for scheduled downtime maybe i can get perl to create that text file you mention for the cron so when cron runs it will not do anything. not sure how the file will be deleted when downtime expires. you think this is better solution.