active/inactive jails
Oliver Fromme
olli at lurza.secnetix.de
Mon Jun 9 11:05:26 UTC 2008
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)
More information about the freebsd-current
mailing list