On Friday 07 November 2008 17:20:19 Vladimir Dronnikov wrote:
> > If you want to use runsvdir as init, you run it as
> > runsvdir [-P] -s SCRIPT /dir
>
> Works fine. Though to reboot I have to use something like:
>
> ---
> #!/bin/sh
> umount -a
> exec reboot -f
> ---
>
> as -s parameter script.

Random side note: you can't call reboot() from PID 1, because on older kernels 
the reboot system call caused the process to exit, and PID 1 exiting the 
kernel, and the kernel would panic before the shutdown actually had a chance 
to happen...

So yes, you have to fork() in order to actually call reboot(), for weird 
historical reasons.

Rob

P.S. Weird historical footnote #2: the magic numbers you feed to reboot() 
are "0xfee1dead" for the first number, and the four options for the second 
number, when listed in hexadecimal, are the birthdays of Linus Torvalds and 
each of his three daughters.  (Your are telling linus to shut down, or Linus 
2.0, 3.0, or 4.0, respectively.)

(No, I don't know if his daughters' machines are each set up to shut down 
using the appropriate code, but I wouldn't put it past him...)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to