linux shell, keep task alive for specified time
        Posted  
        
            by liori
        on Super User
        
        See other posts from Super User
        
            or by liori
        
        
        
        Published on 2010-05-07T20:49:41Z
        Indexed on 
            2010/05/07
            21:00 UTC
        
        
        Read the original article
        Hit count: 322
        
shell
Hello,
I am looking for a tool to keep a task alive (restarting if necessary) for a specified amount of time (in seconds), and then kill it and stop. For example: keep_for 3600 rsync foo bar:faz should for try to synchronize a directory (restarting rsync in case of f.e. dropped connection), but explicitly kill rsync and stop respawning it after an hour.
I tried to write a shell script for that, but it was surprisingly difficult to write, with lots of edge cases (like child process not getting killed, or shell escaping issues). So... maybe there already is a tool for that?
© Super User or respective owner