On Tuesday 16 September 2008 04:30, Steven Woody wrote:
> Hi,
> 
> 1.  Can I get something like bootwait in inittab?  I found 'sysinit'
> is not waiting for invoked script to complete before go to a `respawn'
> entry.

"sysinit" has to wait accourding to this code:

static void run_actions(int action_type)
{
        struct init_action *a, *tmp;

        for (a = init_action_list; a; a = tmp) {
                tmp = a->next;
                if (a->action_type & action_type) {
                        if (a->action_type & (SYSINIT | WAIT | CTRLALTDEL | 
SHUTDOWN | RESTART)) {
HERE =>                         waitfor(run(a));
                                delete_init_action(a);
                        } else if (a->action_type & ONCE) {
                                run(a);
                                delete_init_action(a);
                        } else if (a->action_type & (RESPAWN | ASKFIRST)) {
                                /* Only run stuff with pid==0.  If they have
                                 * a pid, that means it is still running */
                                if (a->pid == 0) {
                                        a->pid = run(a);
                                }
                        }
                }
        }
}

You can instrument waitfor(), making it print PID it waits for,
other pids it sees exiting while it waits for it, etc.

But I suspect you see sysinit "not being waited for" just because
it creates a child, and the parent dies. init thinks that sysinit
completes because it detects parent's exit.

> 2.  Can I automatically get two scripts run before the box shutdown
> and reboot respectively?

Yes, trivially:

# pre_reboot_script.sh
# reboot

--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to