integ/filesystem/nfs-utils/files/nfsserver
Scott Little bab9bb6b69 Internal restructuring of stx-integ
Create new directories:
   ceph
   config
   config-files
   filesystem
   kernel
   kernel/kernel-modules
   ldap
   logging
   strorage-drivers
   tools
   utilities
   virt

Retire directories:
   connectivity
   core
   devtools
   support
   extended

Delete two packages:
   tgt
   irqbalance

Relocated packages:
   base/
      dhcp
      initscripts
      libevent
      lighttpd
      linuxptp
      memcached
      net-snmp
      novnc
      ntp
      openssh
      pam
      procps
      sanlock
      shadow
      sudo
      systemd
      util-linux
      vim
      watchdog

   ceph/
      python-cephclient

   config/
      facter
      puppet-4.8.2
      puppet-modules

   filesystem/
      e2fsprogs
      nfs-utils
      nfscheck

   kernel/
      kernel-std
      kernel-rt

   kernel/kernel-modules/
      mlnx-ofa_kernel

   ldap/
      nss-pam-ldapd
      openldap

   logging/
      syslog-ng
      logrotate

   networking/
      lldpd
      iproute
      mellanox
      python-ryu
      mlx4-config

   python/
      python-2.7.5
      python-django
      python-gunicorn
      python-setuptools
      python-smartpm
      python-voluptuous

   security/
      shim-signed
      shim-unsigned
      tboot

   strorage-drivers/
      python-3parclient
      python-lefthandclient

   virt/
      cloud-init
      libvirt
      libvirt-python
      qemu

   tools/
      storage-topology
      vm-topology

   utilities/
      tis-extensions
      namespace-utils
      nova-utils
      update-motd

Change-Id: I37ade764d873c701b35eac5881eb40412ba64a86
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-01 10:06:31 -04:00

137 lines
3.4 KiB
Bash

#!/bin/sh
### BEGIN INIT INFO
# Provides: nfs-kernel-server
# Required-Start: $remote_fs nfs-common $portmap hwclock
# Required-Stop: $remote_fs nfs-common $portmap hwclock
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Kernel NFS server support
# Description: NFS is a popular protocol for file sharing across
# TCP/IP networks. This service provides NFS server
# functionality, which is configured via the
# /etc/exports file.
### END INIT INFO
#
# Startup script for nfs-utils
#
# Source function library.
. /etc/init.d/functions
#
# The environment variable NFS_SERVERS may be set in /etc/default/nfsd
# Other control variables may be overridden here too
#
# Commented out by 'emacdona' during port to Centos due to change from sysv to systemd
# test -r /etc/default/nfsd && . /etc/default/nfsd
#
# Location of executables:
test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
#
# The user mode program must also exist (it just starts the kernel
# threads using the kernel module code).
test -x "$NFS_MOUNTD" || exit 0
test -x "$NFS_NFSD" || exit 0
#
# Default is 8 threads, value is settable between 1 and the truely
# ridiculous 99
test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8
#
#----------------------------------------------------------------------
# Startup and shutdown functions.
# Actual startup/shutdown is at the end of this file.
#mountd
start_mountd(){
echo -n 'starting mountd: '
start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@"
echo done
}
stop_mountd(){
echo -n 'stopping mountd: '
start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD"
echo done
}
#
#nfsd
start_nfsd(){
modprobe -q nfsd
grep -q nfsd /proc/filesystems || {
echo NFS daemon support not enabled in kernel
exit 1
}
grep -q nfsd /proc/mounts || mount -t nfsd nfsd /proc/fs/nfsd
grep -q nfsd /proc/mounts || {
echo nfsd filesystem could not be mounted at /proc/fs/nfsd
exit 1
}
echo -n "starting $1 nfsd kernel threads: "
start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
echo done
}
delay_nfsd(){
for delay in 0 1 2 3 4 5 6 7 8 9
do
if pidof nfsd >/dev/null
then
echo -n .
sleep 1
else
return 0
fi
done
return 1
}
stop_nfsd(){
# WARNING: this kills any process with the executable
# name 'nfsd'.
echo -n 'stopping nfsd: '
start-stop-daemon --stop --quiet --signal 1 --name nfsd
if delay_nfsd || {
echo failed
echo ' using signal 9: '
start-stop-daemon --stop --quiet --signal 9 --name nfsd
delay_nfsd
}
then
echo done
else
echo failed
fi
}
#----------------------------------------------------------------------
#
# supported options:
# start
# stop
# reload: reloads the exports file
# restart: stops and starts mountd
#FIXME: need to create the /var/lib/nfs/... directories
case "$1" in
start) exportfs -r
start_nfsd "$NFS_SERVERS"
start_mountd
test -r /etc/exports && exportfs -a;;
stop) exportfs -ua
stop_mountd
stop_nfsd;;
status)
status /usr/sbin/rpc.mountd
RETVAL=$?
status nfsd
rval=$?
[ $RETVAL -eq 0 ] && exit $rval
exit $RETVAL;;
reload) test -r /etc/exports && exportfs -r;;
restart)
$0 stop
$0 start;;
*) echo "Usage: $0 {start|stop|status|reload|restart}"
exit 1;;
esac