From owner-freebsd-stable Sun Jan 13 23:20:48 2002 Delivered-To: freebsd-stable@freebsd.org Received: from net2.dinoex.sub.org (net2.dinoex.de [212.184.201.182]) by hub.freebsd.org (Postfix) with ESMTP id 9BC9B37B41D; Sun, 13 Jan 2002 23:20:39 -0800 (PST) Received: from gate.dinoex.sub.org (dinoex@localhost) by net2.dinoex.sub.org (8.11.6/8.11.6) with BSMTP id g0E7K3i20244; Mon, 14 Jan 2002 08:20:03 +0100 (CET) (envelope-from dirk.meyer@dinoex.sub.org) To: henk@wevers.org, freebsd-isp@freebsd.org, freebsd-stable@freebsd.org Message-ID: From: dirk.meyer@dinoex.sub.org (Dirk Meyer) Organization: privat Subject: Re: jail() management scripts Date: Mon, 14 Jan 2002 08:18:15 +0100 X-Mailer: Dinoex 1.77 References: <3C421228.9060904@wevers.org> X-Gateway: ZCONNECT gate.dinoex.sub.org [UNIX/Connect 0.93] X-PGP-Fingerprint: 44 16 EC 0A D3 3A 4F 28 8A 8A 47 93 F1 CF 2F 12 X-ZC-TELEFON: V+49-5606-6512Q F+49-5606-55023 X-Copyright: (C) Copyright 2001 by Dirk Meyer -- All rights reserved. X-ZC-POST: Im Grund 4;34317 Habichtswald;Germany X-PGP-Key-Avail: mailto:pgp-public-keys@keys.de.pgp.net Subject:GET 0x331CDA5D X-ZC-VIA: 20020114000000W+1@dinoex.sub.org Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi Henk Wevers, > If you have some scripts please mail me, then i will add then to the site. you asked :) I use some more jails, and create them in a configuration file. kind regards Dirk - Dirk Meyer, Im Grund 4, 34317 Habichtswald, Germany # # /usr/local/etc/jail.conf # # Format: # dir hostname IP-Addr # jail1 name1.do.main 10.6.200.201 #jail2 inaktiv.do.main 10.6.200.202 # # eof /usr/local/etc/rc.d/jail.sh: #!/bin/sh # (c) 2002 Dirk Meyer, under FreeBSD License # # Thanks to: # - Gregory Neil Shapiro for the "killjail" function. # - Keith Farrar for the "list" and "restart" target. # case $1 in start) grep -v "^#" /usr/local/etc/jail.conf | while read dir name ip do echo "starting ... ${ip} ${name}" jail "${dir}" "${name}" "${ip}" /bin/sh /etc/rc done exit 0 ;; stop) grep -v "^#" /usr/local/etc/jail.conf | while read dir name ip do echo "stopping ... ${ip} ${name}" pids=`grep -l " ${name}\$" /proc/*/status | awk -F/ '{print $3}'` kill -TERM $pids done exit 0 ;; list) grep -v "^#" /usr/local/etc/jail.conf | while read dir name ip do pids=`grep -l " ${name}\$" /proc/*/status | awk -F/ '{print $3}'` echo "processes for ${ip} ${name}:" $pids done exit 0 ;; restart) sh $0 stop seep 1 sh $0 start ;; *) echo "usage: `basename $0` {start|stop|list|restart}" >&2 exit 64 ;; esac # # eof To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message