Date: Wed, 18 Aug 2021 19:19:22 +0200 From: Miroslav Lachman <000.fbsd@quip.cz> To: Dan Langille <dan@langille.org>, freebsd-hackers@freebsd.org Subject: Re: verifying a given jail is running Message-ID: <71fb0edd-2b8a-e9ec-ed7e-ca8d6cdfff17@quip.cz> In-Reply-To: <329b32d4-8f8b-d672-21b1-80820d5b318f@langille.org> References: <329b32d4-8f8b-d672-21b1-80820d5b318f@langille.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 18/08/2021 18:21, Dan Langille wrote: > I could use it like this in a shell script. > > jls -j freshports > /dev/null 2>&1 > if [ $? = 0 ] ; then > echo jail is running > else > echo jail is not running > fi > > The main reason I need this: Verifying the jail is running before > continuing with a script. You can save one line with this: if jls -j freshports > /dev/null 2>&1 ; then echo "jail is running" else echo "jail is not running" fi Or if you don't need the echoed output and just need to stop script execution: jls -j freshports > /dev/null 2>&1 || exit 5 Miroslav Lachman PS: Use jls -d if dying jail is also accepted as running jail (see man jls)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?71fb0edd-2b8a-e9ec-ed7e-ca8d6cdfff17>