in reply to Until...

Alternatively, cron(1) or at(1). ;-) Of course that assume you're on UN*X.

--
I'm not belgian but I play one on TV.

Replies are listed 'Best First'.
Re: Re: Until...
by RMGir (Prior) on Nov 19, 2002 at 12:10 UTC
    Aha, but I _am_ on Un*x.

    The problem is that cron or at will START a task, but they won't kill it if it runs past a certain time...
    --
    Mike

      #!/bin/bash JOB_ID=$(echo kill $$ | at now + 3min | awk '/^job/ {print $2}') cd /foo/bar/ ./baz atrm $JOB_ID
      If it doesn't get killed by at, it removes the kill job from the queue.

      Makeshifts last the longest.

        Very nice, ++!

        That does cover my objections quite nicely.
        --
        Mike

      That's why you setup a job to send kill the process.

      --
      I'm not belgian but I play one on TV.

        I thought of that, but since my task was already _starting_ from a cronjob, having it set up an at job to kill itself later looked even wierder to me than this Until module does :)

        You're right, though, it's another way to do it.

        (Edit: Aha, NOW I remember why I did this! If you set up an at job to kill process nnnnn, there's no guarantee your script won't die for some other reason before the at job runs, so that pid might be reused, which means you might kill the wrong thing, if the pid belongs to you or you're root. This way, process nnnn is a child of Until, so it WILL still be around, even if its defunct.... I don't have the root issue, my script runs as a normal user.)
        --
        Mike