Ubuntu 14.10 : 启动时/etc/rc.local被执行了两次

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
ddk3000
帖子: 22
注册时间: 2014-10-16 15:11
系统: Ubuntu

Ubuntu 14.10 : 启动时/etc/rc.local被执行了两次

#1

帖子 ddk3000 » 2015-09-18 12:55

Ubuntu 14.10上,启动时rc.local被执行了两次,是有问题吗?

Ubuntu 14.04.2上,启动时rc.local只被执行一次。
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: Ubuntu 14.10 : 启动时/etc/rc.local被执行了两次

#2

帖子 vickycq » 2015-09-18 13:13

把 /etc/rc.local 的内容贴上来。
请说明你要执行的内容。
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
ddk3000
帖子: 22
注册时间: 2014-10-16 15:11
系统: Ubuntu

Re: Ubuntu 14.10 : 启动时/etc/rc.local被执行了两次

#3

帖子 ddk3000 » 2015-09-18 13:23

/etc/rc.local 的内容如下:

#!/bin/sh -e
echo `date` >> /var/ddk.log
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

****************************************************************

启动后,/var/ddk.log 中的内容是两行:

Fri Sep 18 13:12:05 CST 2015
Fri Sep 18 13:12:03 CST 2015
ddk3000
帖子: 22
注册时间: 2014-10-16 15:11
系统: Ubuntu

Re: Ubuntu 14.10 : 启动时/etc/rc.local被执行了两次

#4

帖子 ddk3000 » 2015-09-19 11:45

找到原因了

Ubuntu 14.10,在VmWare上安装虚拟机,启动时,/etc/rc2.d/*rc.local 和 /etc/rcS.d/*.rc.local,都会调用 /etc/rc.local,因此执行了两次

奇怪的是,在计算机上安装 Ubunt 14.10,/etc/rcS.d下没有*rc.local,因此/etc/rc.local只会被/etc/rc2.d/*.rc.local调用一次。
回复