Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jul 2006 19:44:07 +0200 (CEST)
From:      Dirk Engling <erdgeist@erdgeist.org>
To:        freebsd-hackers@freebsd.org
Cc:        ezjail@erdgeist.org
Subject:   Rebooting jails
Message-ID:  <20060724192149.O46542@erdgeist.org>

next in thread | raw e-mail | index | archive | help

Hello,

I'm currently looking for a standardized way to 'reboot' jails from 
within. 'shutdown' is a simple one, just issue 'kill -TERM -1' and you're 
done.

Now, rebooting generally involves starting up the jail afterwards.

One way that works from a shell started via jexec would be to 'kill 
-TERM -1' all processes and execve into whatever is supposed to be the 
kickoff command, e.g. /bin/sh /etc/rc. However, doing this from a shell 
that has been run from sshd results in killing the sshd and thus the shell 
trying to restart the jail.

Another way would be to have a daemon waiting in the host system that is 
checking jids in /var/run/jail_*.id say all 5 Minutes and if pgrep returns 
anything than 0, the jail is being restarted (you may combine that with 
some conditions, say having a file '/.rebootme' under jail's root 
directory).

This approach is more a watchdog than a reboot mechanism, you would need 
to do unintuitive stuff like adding a line to crontab (where it would even 
run if no jails are active, which sucks). One could use an 'at +5m 
$prefix/bin/watchdog' in the script that starts the jail in the first 
place which calls itself the same way.

All this is annoying to track, a watchdog script sleeping in the 
background would more easily be visible in ps. And, waiting for the host 
system to finally rerun to jail may cost many boring admin-5min-periods.

Maybe someone can help me out with a cool idea.

Regards

   erdgeist



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060724192149.O46542>