From owner-freebsd-current@FreeBSD.ORG Mon Jun 9 11:05:26 2008 Return-Path: Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BECD2106567B for ; Mon, 9 Jun 2008 11:05:26 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 188758FC19 for ; Mon, 9 Jun 2008 11:05:25 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.1/8.14.1) with ESMTP id m59B54CH003944; Mon, 9 Jun 2008 13:05:04 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.1/8.14.1/Submit) id m59B531I003943; Mon, 9 Jun 2008 13:05:03 +0200 (CEST) (envelope-from olli) Date: Mon, 9 Jun 2008 13:05:03 +0200 (CEST) Message-Id: <200806091105.m59B531I003943@lurza.secnetix.de> From: Oliver Fromme To: freebsd-current@FreeBSD.ORG, bp@barryp.org, mike@reifenberger.com In-Reply-To: <484949E2.8080208@barryp.org> X-Newsgroups: list.freebsd-current User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.2-STABLE-20070808 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Mon, 09 Jun 2008 13:05:05 +0200 (CEST) Cc: Subject: Re: active/inactive jails X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-current@FreeBSD.ORG, bp@barryp.org, mike@reifenberger.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jun 2008 11:05:26 -0000 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 " 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 > > 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)