Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jan 2018 10:22:58 +0000
From:      Steve O'Hara-Smith <steve@sohara.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Limit resources for a given program
Message-ID:  <20180123102258.32e9f4a61132c86b25cbfede@sohara.org>
In-Reply-To: <wu78tcpgmke.fsf@banyan.cs.ait.ac.th>
References:  <wu78tcpgmke.fsf@banyan.cs.ait.ac.th>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 23 Jan 2018 12:40:17 +0700
Olivier <Olivier.Nicole@cs.ait.ac.th> wrote:

> Hi,
> 
> Is there a way, in FreeBSD, to limit the clocktime for a given command?
> 
> I use LibreOffice to automatically convert many types of documents to
> PDF. When it is an HTML document with external links, it will run
> indefinitely, trying to access the external resources. It will not use
> much CPU but mostly sits idled, so limits(8) -t is not the solution, nor
> is rctl(8) that needs a process ID (but I only have the command name) or
> a user ID (but I don't want to limit a user, just that program).
> 
> Any idea how I can solve that?

	Something like this (untested) should do the trick:

#!/bin/sh
libreoffice "$@" &
rctl -a process:$$:wallclock:sigterm=3600

-- 
Steve O'Hara-Smith <steve@sohara.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180123102258.32e9f4a61132c86b25cbfede>