[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 为什么我的cron不能开机自动启动?



On Mon, Aug 13, 2007 at 10:29:19AM +0800, shell909090 wrote:
> 
> 准确说,debian的默认引导系统是init系统,具体使用哪个级别是看
> /etc/inittab这个文件的。
> # The default runlevel.
> id:2:initdefault:
> 
> 0 - halt
> 1 - Single user mode
> 2 - Multiuser, without NFS (The same as 3, if you don't have networking)
> 3 - Full multiuser mode
> 4 - unused
> 5 - X11
> 6 - Reboot

这个表格完全错误。Debian 的默认 /etc/inittab 里写得很清楚:

# /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.

如果看不懂英文的话,Debian 参考手册里也写了:

Debian 使用下列的运行级别:
   * 1(单用户模式 single-user mode),
   * 2 到 5(多用户模式 multi-user modes),
   * 0(关闭系统),
   * 6(重启系统)。
运行级 7、8 和 9 也能够使用,但是它们的 rc 目录在软件包安装的时候没有。

> debian中一般都是2。
> 
> 而后在rrc$runlevel.d中和rcS.d中的链接会被执行。
> 首先执行/etc/rc$previous.d/K[0-9][0-9]$suffix,以参数stop。
> 而后执行/etc/rc$previous.d/S[0-9][0-9]$suffix,以参数start。

执行 start 的 script 怎么会是 /etc/rc$previous.d/ 下的?应该是要切换到的
runlevel 下的 S 起头的 script 才对。

> 完成runlevel的切换。
> 
> 另外cron虽然定时运行,但是如果发生事件的时刻cron并不在运行,则对应的脚
> 本不会被触发。

严格说来,cron 是 daemon 程序,一开机就会运行并一直处于背景里,并不是定时
运行。

> 这种情况下请用anacron。这个程序会在启动事检查事件对是否在上个时间被触
> 发过了,如果没有则触发。
> 说实话,对于桌面系统,这个程序更为有用。

Ming
2007.08.14



Reply to: