Re: active/inactive jails

From: Oliver Fromme <olli_at_lurza.secnetix.de>
Date: Mon, 9 Jun 2008 13:05:03 +0200 (CEST)
Barry Pederson wrote:
 > 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.

The problem with pgrep is that -- unlike ps -- the output
is not configurable (e.g. to list UIDs etc.).  Therefore
I think pgrep is mostly useful for scripts only, but not
that much for interactive work.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"Clear perl code is better than unclear awk code; but NOTHING
comes close to unclear perl code"  (taken from comp.lang.awk FAQ)
Received on Mon Jun 09 2008 - 09:05:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:31 UTC