Profiel van 麦田守望者异想空间Foto'sWeblogLijsten Extra Help

Weblog


    26-10-2009

    与rc有关的几个重要文件

    OpenBSD uses an rc(8) style startup. This uses a few key files for startup.

    • /etc/rc - 主脚本。不应该编辑它。
    • /etc/rc.conf - /etc/rc使用的配置文件,用于为系统设置启动参数。
    • /etc/rc.conf.local - 配置文件。此文件中的设置会覆盖掉/etc/rc.conf中的相同的设置值,因此不该直接编辑它。当升级你的系统的时候,这很重要。
    • /etc/netstart - 用于初始化网络的脚本。不应该编辑它。
    • /etc/rc.local - 用于本地管理的脚本。特定于守护进程或者主机的信息放在这个文件中。
    • /etc/rc.securelevel - 脚本文件,它执行那些必须在安全级别变动之前执行的命令。参看 init(8)
    • /etc/rc.shutdown - 在关机的时候执行的脚本文件。关机前你想要做的任何事情都可以放在这个文件里。参看 rc.shutdown(8)

    以上摘自OpenBSD FAQ。在理解了它们各自的用途之后,需要注意使用它们的注意事项。

    22-10-2009

    在命令行中调节音量

    在命令行调节音量使用mixerctl,方法如下:

    $ mixerctl outputs.master=200,200

    其中,两个数值200,分别代表的是左右声道的音量,中间用一个逗号分隔。其取值范围是0到255。不加任何参数执行mixerctl,能够看到系统当前的音频配置参数。

    把系统时间调整为本地时间

    By default, OpenBSD assumes your hardware clock set to UTC (Universal Coordinated Time) rather than local time, assumed by some other operating systems, which can cause problems when multi-booting.

    Many other operating systems, can be configured to do the same, which avoids this problem altogether.

    If having the hardware clock set to UTC is a problem, you can change the default behavior of OpenBSD using config(8). For example, to configure OpenBSD to use a hardware clock set to US/Eastern (5 hours behind UTC, so 300 minutes):

    # config -ef /bsd
    OpenBSD 4.6 (GENERIC.MP) #89: Thu Jul 9 21:32:39 MDT 2009
    deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
    Enter 'help' for information
    ukc> timezone 300
    timezone = 300, dst = 0
    ukc> quit
    Saving modified kernel.

    See options(4) and search for option "TIMEZONE=value" for more information.

    以上是从OpenBSD FAQ中摘录的。config命令用于更改时区。对于北京时间,使用如下命令行修改时区:

    ukc> timezone -480

    timezone的参数是以分钟为单位。因此,八小时为480分钟。quit之后,重启心爱的OpenBSD,date一下。看,时间变过来了。


    21-10-2009

    OpenBSD的rc脚本是如何工作的(摘录)

    The main files a system administrator should concentrate on are /etc/rc.conf (for guidance), /etc/rc.conf.local (for changes), /etc/rc.local and /etc/rc.shutdown. To get a look of how the rc(8) procedure works, here is the flow:

    After the kernel is booted, /etc/rc is started:

    • Filesystems are checked.
    • Default configuration variables are read in from /etc/rc.conf, then local changes to those variables are read from /etc/rc.conf.local. Settings in rc.conf.local will override those in rc.conf.
    • Filesystems are mounted
    • Clears out /tmp and preserves any editor files
    • Configures the network via /etc/netstart
      • Configures your interfaces up.
      • Sets your hostname, domainname, etc.
    • Starts system daemons
    • Performs various other checks (quotas, savecore, etc)
    • Local daemons are run, via /etc/rc.local
     
    *