[BusyBox] how to automatically start an app at boot time?

Jeff Angielski jeff at theptrgroup.com
Tue Jan 20 12:45:06 UTC 2004


We ran into a similiar problem.  The app runs fine from the shell but
stops prematurely when started during the init sequence.

I believe the problem was related to the management of the parent/child
processes as the inittab is parsed and executed.  Check out
run_actions() in init.c to see how this is handled.

A quick check to determine if this is the case is run your application
using "once" in the inittab instead of "sysinit".

If this works for you, you might want to daemonize your application and
be done with it.

Jeff Angielski
The PTR Group


On Mon, 2004-01-19 at 07:16, Robert P. J. Day wrote:
> On Sun, 18 Jan 2004, Steve Dover wrote:
> 
> > Robert P. J. Day wrote:
> > >   currently, a couple of us are grappling with trying to start an app at
> > > boot time.  we're using 1.00-pre5, with
> > > 
> > >   /linuxrc -> bin/busybox
> > > 
> > > and a simple inittab with a single shell being started with the "askfirst"
> > > action field.
> > > 
> > >   our first obvious attempt was to check out /etc/init.d/rcS, and at the
> > > bottom, there is a conditional invocation of /sbin/setup.sh.  so we just
> > > added the invocation of our application to /sbin/setup.sh.
> > > 
> > >   sadly, our app doesn't get invoked at boot time, but it runs just fine
> > > if we start it manually once we get a shell prompt.
> > > 
> > >   can someone explain the ideal method for starting the main system
> > > app at boot time?  we need to be able to set a few environment vars
> > > before actually starting it.  so what's the recipe?  thanks.
> > > 
> > > rday
> > 
> > In your inittab, have an entry that kicks off rcS :
> > 
> > ::sysinit:/etc/init.d/rcS
> > 
> > Have that script do your setup stuff such as mounting /proc, etc.
> > and have it start any background daemons that you want running.
> 
> we're already doing that.  we have that line in our /etc/inittab file, and
> at the bottom of /etc/init.d/rcS, we found the original lines:
> 
> 	if [ -x /sbin/setup.sh ]
> 	then
>   		/sbin/setup.sh
> 	fi
> 
> so we added the invocation of our app to the /sbin/setup.sh file.  the
> invocation involves setting some env vars, then running the program. print
> statements show that the boot time execution is, in fact, getting there,
> but the app is not invoked (or, at least, if it's invoked, it stops
> immediately).
> 
> if, however, we wait until we get a shell prompt, we can run the app fine
> from the command line.  i'm wondering if there's something critical that's
> missing or hasn't been initialized yet earlier in the boot process that
> prevents the app from starting properly.
> 
> i'm fairly familiar with the linux boot sequence, but not that familiar
> with how busybox might change some of that, so we're still a little
> puzzled.
> 
> rday
>  
> 
> ______________________________________________________________________
> 
> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net
> http://busybox.net/mailman/listinfo/busybox




More information about the busybox mailing list