All pastes #49021 Raw Edit

Miscellany

public text v1 · immutable
#49021 ·published 2006-04-11 13:21 UTC
rendered paste body
service system/nfs/idmapd { 
    need = system/bootmisc net;
 
 script start = { 
    idmapd=/usr/sbin/rpc.idmapd 
    [[ ! -x ${idmapd} ]] && return 0 
 
    if grep -q rpc_pipefs /proc/filesystems ; then 
       if ! grep -q "rpc_pipefs /var/lib/nfs/rpc_pipefs" /proc/mounts ; then 
          [[ ! -d /var/lib/nfs/rpc_pipefs ]] && mkdir -p /var/lib/nfs/rpc_pipefs 
          mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs 
       fi 
    fi 
 
    ${idmapd} ${RPCIDMAPDOPTS} 
 };
 
 script stop = { 
    idmapd=/usr/sbin/rpc.idmapd 
    restarting=no 
    [[ ! -x ${idmapd} ]] && return 0 
 
    start-stop-daemon --stop --quiet --exec ${idmapd} 
    ret=$? 
 
    if [[ $restarting == "no" ]] ; then 
       if grep -q "rpc_pipefs /var/lib/nfs/rpc_pipefs" /proc/mounts ; then 
          umount /var/lib/nfs/rpc_pipefs 
       fi 
    fi 
 
    return ${ret} 
 };
 } 
 
 service system/nfs/statd { 
    need = system/bootmisc net;
 
 script start = { 
    statd=/sbin/rpc.statd 
    # Don't start rpc.statd if already started by init.d/nfsmount 
    killall -0 rpc.statd &>/dev/null && return 0 
    start-stop-daemon --start --quiet --exec \ 
       $statd -- $RPCSTATDOPTS 1>&2 
 }; 
 
 script stop = { 
    statd=/sbin/rpc.statd 
    # Don't stop rpc.statd if it's in use by init.d/nfsmount. 
    mount -t nfs | grep -q . && return 0 
    # Make sure it's actually running 
    killall -0 rpc.statd &>/dev/null || return 0 
    # Okay, all tests passed, stop rpc.statd 
    start-stop-daemon --stop --quiet --exec $statd 1>&2 
 } 
 };
 
 service system/nfs/exportfs { 
    need = system/bootmisc net;
 
 script start = { 
    local pid=$1 
    ( sleep ${EXPORTFSTIMEOUT:-30}; kill -9 $pid &>/dev/null ) & 
    wait $1 
 }; 
 }
 
 service system/nfs { 
    need = system/bootmisc net; 
 
 script start = { 
    mountd=/usr/sbin/rpc.mountd 
    nfsd=/usr/sbin/rpc.nfsd 
    rquotad=/usr/sbin/rpc.rquotad 
    exportfs=/usr/sbin/exportfs 
    # Make sure nfs support is loaded in the kernel #64709 
    if [ -e /proc/modules ] ; then 
       modprobe nfsd &> /dev/null 
    fi 
 
    # This is the new "kernel 2.6 way" to handle the exports file 
    if grep -q nfsd /proc/filesystems &>/dev/null; then 
       if ! grep -q "nfsd /proc/fs/nfs" /proc/mounts &>/dev/null; then 
          mount -t nfsd nfsd /proc/fs/nfs 
       fi 
    fi 
    # now that nfsd is mounted inside /proc, we can safely start mountd later 
 
    if [ -x $rquotad ]; then 
       start-stop-daemon --start --quiet --exec \ 
          $rquotad -- $RPCRQUOTADOPTS 1>&2 
    fi 
 
    start-stop-daemon --start --quiet --exec \ 
       $nfsd -- $RPCNFSDCOUNT 1>&2 
 
    # Start mountd 
    start-stop-daemon --start --quiet --exec \ 
       $mountd -- $RPCMOUNTDOPTS 1>&2 
 }; 
 
 script stop = { 
    mountd=/usr/sbin/rpc.mountd 
    rquotad=/usr/sbin/rpc.rquotad 
    exportfs=/usr/sbin/exportfs 
    # Don't check NFSSERVER variable since it might have changed, 
    # instead use --oknodo to smooth things over 
    start-stop-daemon --stop --quiet --oknodo \ 
       --exec $mountd 1>&2 
 
    # nfsd sets its process name to [nfsd] so don't look for $nfsd 
    start-stop-daemon --stop --quiet --oknodo \ 
       --name nfsd --user root --signal 2 1>&2 
 
    if [ -x $rquotad ]; then 
       start-stop-daemon --stop --quiet --oknodo \ 
          --exec $rquotad 1>&2 
    fi 
 }; 
 }