active/inactive jails

Barry Pederson bp at barryp.org
Fri Jun 6 15:07:51 UTC 2008


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


More information about the freebsd-current mailing list