monitoring multiple jobs Unix

I have a list of jobs. their expected start time and their expected duration.

my needs are

  • monitor multiple jobs (starting at different time and their execution time also differs)
  • Need to mail if any of the job running longer than its expected duration.

Whats the efficient way to scripting & scheduling to monitor the script..??

I would make a wrapper script that would do the following:

Set a trap for child exit
On child trap, exit because we didn't exceed time

Get commmand and time from command line
execute command in background 

while time < expected
 sleep short time (1 minute?)
 if command not running then exit
end while

Email alert

You don't want to sleep in a shell for the expected time because you won't get the child exit trap until you wake up if the monitored command exited earlier.