Re: verifying a given jail is running
- In reply to: Dan Langille : "verifying a given jail is running"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Aug 2021 17:19:22 UTC
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)