add start/stop/restart single jail to /etc/rc.d/jail
I was getting very annoyed at the fact that when I do /etc/rc.d/jail
restart it restarts all jails and there didnt seem to be an easy way
to do that for only one jail on a machine.
The attached patch allows you to do
/etc/rc.d/jail (stop/start/restart) (jailname)
Something that might need more thinking(this works well enough for me)
but on stop it searchs the jail list for a jail referenced by
jailname. It then finds the JID based on hostname and issues jexec
JID kill -TERM -1. If your jls gets filled up with multiple entries
for the same hostname it gets kinda broken, also if you have jails
that do in fact have the same hostname you also get confusion. Maybe
it should match all fields instead of just hostname?
Kevin L. Kane
kevin.kane at gmail.com
#1 Updated by schmidtm almost 8 years ago
Your patch is against rev 1.4. The newest one is 1.5, so the patch
won't apply cleanly. Could you please resubmit a diff against latest
To be on the safe side, this would be nice. A bit of awk/shell magic
should do the trick. A jls output with the same jail happens quite
often (for me at least :):
JID Hostname Path IPs
10 jail1 /usr/jail/j1 10.253.195.110
8 jail1 /usr/jail/j1 10.253.195.110
#2 Updated by kevin.kane almost 8 years ago
Ok will do.
Is that happening because one of them should be there or are both of
those running at the same time. I get that alot when I kill a jail
and then it goes away after a random interval of time, seems like
something goes around and does some garbage collection after a
Is it appropriate to assume that identical jls entries are not a
normal mode of operation, i could easily send stop signals to both of
#3 Updated by victor almost 8 years ago
you might want to take a look at FreeBSD's jail init script. It
allows to do what you want but doesn't have the problem with jails
that have the same name. Their solution is (was?) to save the ID
of the jail on a file when it boots and then use that to stop it.
I ported it sometime ago but at the time they had some security issues
with it and waited until they were sorted. Then i forget about the
changes and never committed it. If i recall correctly the
changes needed to jail(8) were committed, but if not, just tell me
and i'll take a look. The rest should be easy to port.
La prueba más fehaciente de que existe vida inteligente en otros
planetas, es que no han intentado contactar con nosotros.