user application startup

Nov 18, 2004 2 Replies

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.


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

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/ update-rc.d 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/ start.

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

--mikeb

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required