[BusyBox] Help - how to start a script after busybox is loaded?
Geoffrey Espin
espin at idiom.com
Fri May 3 14:06:03 UTC 2002
On Fri, May 03, 2002 at 02:41:22PM -0500, Lee Xing wrote:
> Yes, I do use /etc/init.d/rcS to load a couple of modules and start a daemon. But all activities (loading modules and starting the daemon) defined in rcS are started before the following step (where busybox is fully loaded):
>
> ...
> BusyBox v0.60.0 (2001.08.24-22:09+0000) Built-in shell (ash)
> Enter 'help' for a list of built-in commands.
>
> and it causes a problem. The problem is the daemon started by rcS always gets closed when seeing the above trace. That's why I'm looking for a way to start a script (which loads modules and starts a daemon) after the above step (i.e. after busybox is fully loaded).
Oh.
Not sure what you mean "trace". But with 0.60.0 maybe this is
the problem/solution:
http://busybox.net/lists/busybox/2002-March/011023.html
Also check the thread on this subject.
Geoff
--
Geoffrey Espin
espin at idiom.com
--
>From busybox-admin at busybox.net Mon Mar 4 09:20:27 2002
From: Geoffrey Espin <espin at idiom.com>
To: BusyBox <busybox at busybox.net>
Subject: Re: [BusyBox] Starting services with busybox init
Date: Mon, 4 Mar 2002 09:19:24 -0800
> > BusyBox init doesn't detach rcS from the terminal, so that
> > processes spawned therein receive a SIGHUP and die if they don't
> > detach in time.
> So what more do we need to do to detach client programs from the
> terminal? After the fork I close all file descriptors and call
> setsid() -- isn't that enough? I guess I am missing something...
> <goes and looks at sysvinit sources>
> Ok, I think I see what needs to be done...
This came up some months ago... just add this to the beginnig of rcS:
# allow scripts to continue running after rcS completes
trap "" SIGHUP
Attached is my rcS, which is mainly what Erik wrote some time ago.
Geoff
--
Geoffrey Espin
espin at idiom.com
--
#!/bin/sh
#
# rcS
# Start all init scripts in /etc/init.d
# executing them in numerical order.
# allow scripts to continue running after rcS completes
trap "" SIGHUP
echo "Running $0 ."
for i in /etc/init.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
echo "Running $i ."
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
echo "Done $i ."
done
echo "Done $0 ."
_______________________________________________
busybox mailing list
busybox at busybox.net
http://busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list