timeout

I can’t believe I’ve missed this: the timeout command of coreutils. It kills a job if it runs longer than a specific time. So if you want to make sure your long_running_job is furnished the next day, when production hours start again:

timeout --kill-after 12h --signal 9 long_running_job

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.