[BusyBox] Starting services with busybox init
Geoffrey Espin
espin at idiom.com
Mon Mar 4 10:20:06 UTC 2002
> > 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 ."
More information about the busybox
mailing list