tags:

views:

169

answers:

1

Seems it has a respawn parameter,

But I haven't figured out how to use it.

+3  A: 

Such as

mine:234:respawn:/usr/local/bin/myscript

See this page for a good explanation

http://aplawrence.com/Unixart/startup.html

A more verbose example:

# Level to run in
id:2:initdefault:

# Boot-time system configuration/initialization script.
si::sysinit:/etc/rc.sysinit

# What to do in single-user mode.
~:S:wait:/sbin/sulogin

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/rc 0
l1:1:wait:/etc/rc 1
l2:2:wait:/etc/rc 2
l3:3:wait:/etc/rc 3
l4:4:wait:/etc/rc 4
l5:5:wait:/etc/rc 5
l6:6:wait:/etc/rc 6

# What to do at the "3 finger salute".
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# Runlevel 2,3: getty on virtual consoles
# Runlevel   3: mgetty on terminal (ttyS0) and modem (ttyS1)
1:23:respawn:/sbin/mingetty tty1
2:23:respawn:/sbin/mingetty tty2
3:23:respawn:/sbin/mingetty tty3
4:23:respawn:/sbin/mingetty tty4
S0:3:respawn:/sbin/agetty ttyS0 9600 vt100-nav
S1:3:respawn:/sbin/mgetty -x0 -D ttyS1
Aiden Bell
Thanks,it helps,but what is the "init q" exactly?
Shore
Q or q tell init to re-examine the /etc/inittab file.
Aiden Bell
OK,got it,my final question is how to set levels correctly?
Shore
@Shore , see my edit. It contains comments that explain runlevels.
Aiden Bell