Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jun 2008 09:29:54 -0500
From:      Barry Pederson <bp@barryp.org>
To:        freebsd-current@FreeBSD.ORG, mike@reifenberger.com
Subject:   Re: active/inactive jails
Message-ID:  <484949E2.8080208@barryp.org>
In-Reply-To: <200806060742.m567g8hn087608@lurza.secnetix.de>
References:  <200806060742.m567g8hn087608@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Oliver Fromme wrote:
> Michael Reifenberger wrote:

>  > Is there an convinient way to get the processes associatet with
>  > an jail.
> 
> ps(1) can display the jail numbers:  "ps -o jid,command"
> (JID 0 means the host system).  You can easily filter the
> output by jail ID.  If you don't know the jail ID, use
> jls(8) to find the jail by hostname, IP number or chroot
> path (which only works if you keep them unique, of course).
> 
> I once wrote a script called "jps" that makes it a little
> easier.  "jps" lists all jailed processes with their JID,
> and "jps <JID>" lists only the processes that belong to
> the specified JID.
> 
> http://www.secnetix.de/olli/scripts/jps

I think pgrep(1) is what you're looking for here.  Once you find the 
jail ID with jls(8), you can run

    pgrep -lf -j <jail_id>

to get a list if processes for that particular jail.

	Barry



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