Project

General

Profile

Actions

Bug #899

closed

add start/stop/restart single jail to /etc/rc.d/jail

Added by kevin.kane about 16 years ago. Updated over 15 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

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?

Kevink
-

Kevin L. Kane
kevin.kane at gmail.com


Files

startstopindividualjails.patch (2.36 KB) startstopindividualjails.patch kevin.kane, 12/29/2007 03:42 AM
Actions #1

Updated by schmidtm about 16 years ago

Hi Kevin,

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
HEAD.

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

Regards,

Matthias
Actions #2

Updated by kevin.kane about 16 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
fashion.

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
them.

Thanks,
Kevink

Actions #3

Updated by victor about 16 years ago

Hello Kevin,

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.

Regards.
--
La prueba más fehaciente de que existe vida inteligente en otros
planetas, es que no han intentado contactar con nosotros.

Actions #4

Updated by kevin.kane over 15 years ago

The functionality I wanted has since been brought into dragonfly, so this can
be closed.

Actions

Also available in: Atom PDF