如何使用inittab自动重启PHP程序?

时间:2009-06-01 22:39:52

标签: linux

似乎它有一个respawn参数,

但我还没弄清楚如何使用它。

1 个答案:

答案 0 :(得分:4)

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

请参阅此页以获得更好的解释

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

一个更详细的例子:

# 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