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 <nc...@alpinelinux.org>
---
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
-- 
1.8.0.3


------------------------------------------------------------------------------
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
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to