Next Previous Contents

4. 执行这两个 daemon

这两个 daemon 是 /usr/sbin/smbd 和 /usr/sbin/nmbd.

你可以执行 Samba daemon 从 inetd 或当成单独的程序. 如果你正设定一个永久文档伺服器,你应该从 inetd 来执行,所以如果他们死掉,那将重新开始.如果你只是偶尔想要使用 SMB 伺服器,或者用系统管理来辅助,当你需要时,你可以藉由使用 /etc/rc.d/init.d script,或甚至直接手动的.

要从 inetd 来执行 daemon , 请放以下几行在 inetd 组态档, /etc/inetd.conf:


    # SAMBA NetBIOS services (for PC file and print sharing)
    netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
    netbios-ns dgram udp wait root /usr/sbin/nmbd nmbd

然后下指令以便重新启动 inetd daemon :


    kill -HUP 1

要从系统启动的 script 来执行 daemon, 请把以下的 script 置于一个叫做 /etc/rc.d/init.d/smb 档, 而且 symbolically link 到注释{comments}所说明的文档:


    #!/bin/sh

    #
    # /etc/rc.d/init.d/smb - starts and stops SMB services.
    #
    # The following files should be synbolic links to this file:
    # symlinks: /etc/rc.d/rc1.d/K35smb  (Kills SMB services on shutdown)
    #           /etc/rc.d/rc3.d/S91smb  (Starts SMB services in multiuser mode)
    #           /etc/rc.d/rc6.d/K35smb  (Kills SMB services on reboot)
    #

    # Source function library.
    . /etc/rc.d/init.d/functions

    # Source networking configuration.
    . /etc/sysconfig/network

    # Check that networking is up.
    [ ${NETWORKING} = "no" ] && exit 0

    # See how we were called.
    case "$1" in
      start)
        echo -n "Starting SMB services: "
        daemon smbd -D  
        daemon nmbd -D 
        echo
        touch /var/lock/subsys/smb
        ;;
      stop)
        echo -n "Shutting down SMB services: "
        killproc smbd
        killproc nmbd
        rm -f /var/lock/subsys/smb
        echo ""
        ;;
      *)
        echo "Usage: smb {start|stop}"
        exit 1
    esac


Next Previous Contents