Jerry Geis wrote: > Hi, > > I am wondering if there exists a centos command that runs another command > and ensures the second command doesnt take more than x seconds? When x > is given on the command line. > > If the second command is not "done" the first command will just kill it > and both exit. > > Does such a method or command exist? > > I just need to ensure the second command does just continue to run and > run and run. Here's my admittedly kludgey quick and dirty way of doing this .... write a shell script that does the following: 1. takes two arguments -- the command to run (in quotes) and then the drip dead time (in seconds? or minutes?) 2. start the command in the background, saving its PID in a var (say $pid). 3. create an "at" job to kill the pid at the appointed time, as in: echo kill -TERM $pid | at now + 15 minutes If the job has already finished, the kill -TERM will hopefully be harmless (i.e., the pid's haven't cycled around and there is now a new, but different, job with the same pid).