On 01/04/2013 04:15 AM, Natanael Copa wrote: > busybox uses different signals for poweroff and reboot. Check if init > is a symlink to busybox and use the busybox variants, USR2 and TERM. > > Signed-off-by: Natanael Copa <[email protected]>
We quickly talked about this with Serge and we seem to agree that we
shouldn't special-case init systems like this.
Instead what should be done is make lxc-shutdown a part of lxc-stop
(in C) and have it call the shutdown feature of the API, reducing the
whole thing to a single code path.
Then we should introduce two new config options along the lines of:
lxc.signals.shutdown
lxc.signals.reboot
That would default to SIGINIT and SIGPWR respectively, so distributions
using init systems that don't use those signals can have their template
write the additional config entries.
> ---
> I have only tested this busybox so please test before pusing it.
>
> Thanks!
>
> src/lxc/lxc-shutdown.in | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/lxc/lxc-shutdown.in b/src/lxc/lxc-shutdown.in
> index edf735e..1a1f455 100644
> --- a/src/lxc/lxc-shutdown.in
> +++ b/src/lxc/lxc-shutdown.in
> @@ -117,11 +117,21 @@ if [ "$pid" = "-1" ]; then
> exit 1
> fi
>
> +signal_reboot=INT
> +signal_poweroff=PWR
> +init_exe=$(readlink -f /proc/$pid/exe)
> +case ${init_exe} in
> + */busybox)
> + signal_reboot=TERM
> + signal_poweroff=USR2
> + ;;
> +esac
> +
> if [ $reboot -eq 1 ]; then
> - kill -s INT $pid
> + kill -s $signal_reboot $pid
> exit 0
> else
> - kill -s PWR $pid
> + kill -s $signal_poweroff $pid
> fi
>
> if [ $dowait -eq 0 ]; then
>
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812
_______________________________________________ Lxc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lxc-devel
