Controlling the duration of Cron Scheduled jobs
Say you need to debug a pesky problem by running some traces for 30 minutes at midnight, or you would just like to use your Linux system as an alarm clock. This tip helps you stop jobs, such as those started with the cron and at capabilities, after the jobs have run for a certain time, or when some other criteria are met.
Linux and UNIX systems allow you to schedule jobs in the future, either just once or on a recurring schedule. A reader of another recent tip, Job scheduling with cron and at, wanted to know how to record a radio or TV program and stop the recording when the program ended. I was reminded of Ettore Bugatti, an Italian who built very fine cars in Alsace-Lorraine. When a customer asked about his use of cable-operated brakes, long after other car makers had switched to hydraulic brakes, Bugatti replied, "Monsieur, I make my cars to go, not to stop." So this tip adds brakes to your job scheduling needs.
Terminating a job after a certain time, or after other criteria are met, usually involves having one process to run the job and another to monitor the completion criteria. In this tip you learn how to have a process manage the time while the real job runs. You also learn how to use the signal and trap facilities to terminate one of these tasks if the other finishes prematurely.
799 views

Post new comment