当前版引入rc.d不知怎样添加运行(已解决见#6)

OpenBSD的安装、升级、更新等日常问题。

版主: chenjun天地乾坤

回复
头像
lionux
锌 Zn
帖子: 457
注册时间: 2010-02-04 11:09

当前版引入rc.d不知怎样添加运行(已解决见#6)

帖子 lionux » 2010-12-18 13:25

Added a simple 'rc' system to base (/etc/rc.subr) in order to start/stop/restart/reload services installed by the ports system.
cat /etc/rc.local
# $OpenBSD: rc.local,v 1.41 2010/11/05 10:03:00 ajacoutot Exp $

# Site-specific startup actions, daemons, and other things which
# can be done AFTER your system goes into securemode. For actions
# which should be done BEFORE your system has gone into securemode
# please see /etc/rc.securelevel.

echo -n 'starting local daemons:'

for _r in $rc_scripts; do
[ -x /etc/rc.d/${_r} ] && echo -n " ${_r}" && /etc/rc.d/${_r} start
done

# Add your local startup actions here.

echo '.'
cat /etc/rc.d/dbus_daemon
#!/bin/sh
#
# $OpenBSD: dbus_daemon.rc,v 1.5 2010/12/16 07:13:59 ajacoutot Exp $

. /etc/rc.d/rc.subr

daemon="${TRUEPREFIX}/bin/dbus-daemon"
daemon_flags="--system"

rc_pre() {
rm -f /var/run/dbus/pid
install -d -o _dbus -g _dbus /var/run/dbus
}

rc_cmd $1

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-12-18 14:07

安装d-bus时的提示吗?我这里现在只在老机上安装了OpenBSD(主要是服务器环境), 还跑不了X, 是nvidia的驱动问题,很难缠。所以也没有安装桌面。
还真没有研究过rc.d,原来都是直接照着packages的提示来,这里能解决问题吗?
否则,告诉我man的地址。不行我先翻译了试试看。

头像
lionux
锌 Zn
帖子: 457
注册时间: 2010-02-04 11:09

帖子 lionux » 2010-12-18 21:30

我也是nvidia卡集成的,没问题啊。
上面rc.local里是启动的脚本,下面dbus_daemon是安装dbus自动装到/etc/rc.d/下的。当时安装后没有看提示,以为过后可以在pkg_info中看到,可pkg_info中没有启动的提示,原来启动方式有改变,man里也找不到。有段时间没用openbsd变化很大啊。

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-12-18 22:43

lionux 写了:我也是nvidia卡集成的,没问题啊。
上面rc.local里是启动的脚本,下面dbus_daemon是安装dbus自动装到/etc/rc.d/下的。当时安装后没有看提示,以为过后可以在pkg_info中看到,可pkg_info中没有启动的提示,原来启动方式有改变,man里也找不到。有段时间没用openbsd变化很大啊。
我是从网上查到的,
-M Show the install-message file (if any) for each package.
看看是否可行,我这里的X回头再说,先试试你的:

看dbus的安装信息:

代码: 全选

# pkg_info -M dbus

看所有packages的安装信息:

代码: 全选

# cd /var/db/pkg; pkg_info -M * | less

头像
lionux
锌 Zn
帖子: 457
注册时间: 2010-02-04 11:09

帖子 lionux » 2010-12-19 9:35

# pkg_info -M 是查看安装信息。
感谢!

头像
lionux
锌 Zn
帖子: 457
注册时间: 2010-02-04 11:09

帖子 lionux » 2011-03-04 21:15

man更新了里面有了rc.d的使用方法,比方dbus_daemon,打开rc.conf.local加入下面一行。
rc_scripts="dbus_daemon"
加入其他的daemon用空格分割添加到引号中,写法有点像archlinux。
详细的说明可以man rc.conf.localman rc.dman rc.subr

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2011-03-04 21:47

说实话,感觉说的还是不够细致,这也是刚学BSD的人最疑惑的地方,要找一个问题的答案在man里被支使来支使去的,最后还不见得可以找到,而且有的也是只鳞片爪。
不全面地了解Unix系统的概念和系统特性要读懂的这些Man也不是很容易的事情。

头像
lionux
锌 Zn
帖子: 457
注册时间: 2010-02-04 11:09

帖子 lionux » 2011-03-05 18:11

这个rc.d现在在当前版里的,在man rc.conf.local里看到的使用方法。
The fourth section contains the rc_scripts variable, responsible for
starting and stopping rc.d(8) scripts in the specified order. For
example, the following line

rc_scripts="dbus_daemon cupsd"

will run /etc/rc.d/dbus_daemon then /etc/rc.d/cupsd with the start
argument at boot time and in reverse order with the stop argument at
shutdown.
4.9发行版应该会正式应用,好处是不用自己写启动脚本了。

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 27 访客