user application startup

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
What is the best way to have a user application start automatically when a
system starts up.  I want it to always start after all drivers and services
have been loaded.



Re: user application startup

Quoted text here. Click to load it

Not sure it's the *best* way, but I do things like this...

/etc/inittab

::sysinit:/etc/init.d/rcS
tty1::askfirst:/bin/login
tty2::askfirst:/bin/login
ttyS0::respawn:/sbin/getty -L ttyS0 9600
::ctrlaltdel:/sbin/swapoff -a
::ctrlaltdel:/bin/umount -a


/etc/init.d/rcS

#! /bin/sh
insmod doc.o
mount -a # Mount the default file systems mentioned in /etc/fstab
hostname rhobert
syslogd -m 30
klogd
/bin/hesc104 -k &


... the hesc104 is a user mode program

Mike

Re: user application startup
Quoted text here. Click to load it


Add a script in /etc/init.d - with "start, stop, restart, optional reload"
entry points.

In Debian, you can use the /etc/init.d/skeleton as a template for this.
Make sure to set permissions 755. Then issue the following:

    chmod 755 /etc/init.d/<program>
    update-rc.d <program> defaults

You now have a well behaved application, which will start automatically
on boot and stop on system shutdown.

If you want to start your application manually /etc/init.d/<program> start.

Redhat has the same environment, the structure of the init.d/<program>
is a little different (same entry points).


--mikeb

Site Timeline