[fedfs-utils] [PATCH 5/8] contrib: Add rpcfedfs init script
Chuck Lever
chuck.lever at oracle.com
Mon Sep 19 15:42:31 PDT 2011
To reduce confusion (slightly), let's distribute sample init scripts
with the fedfs-utils package rather than separately.
To kick things off, copy the Red Hat-based rpcfedfsd script I wrote
from my fedfs-init-scripts repo to contrib/init-scripts/rpcfedfsd, and
create appropriate Makefile infrastructure to ensure that these files
are distributed in the tar files (but are not installed).
Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
---
Makefile.am | 2 -
configure.ac | 2 +
contrib/Makefile.am | 28 +++++++++
contrib/init-scripts/Makefile.am | 28 +++++++++
contrib/init-scripts/rpcfedfsd | 121 ++++++++++++++++++++++++++++++++++++++
5 files changed, 180 insertions(+), 1 deletions(-)
create mode 100644 contrib/Makefile.am
create mode 100644 contrib/init-scripts/Makefile.am
create mode 100755 contrib/init-scripts/rpcfedfsd
diff --git a/Makefile.am b/Makefile.am
index 52c8329..7a92ced 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,7 @@
##
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = doc src
+SUBDIRS = doc src contrib
dist_noinst_SCRIPTS = autogen.sh
EXTRA_DIST = ChangeLog COPYING README INSTALL doxy.cfg .gitignore
CLEANFILES = cscope.in.out cscope.out cscope.po.out
diff --git a/configure.ac b/configure.ac
index 84eea21..e97b5f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,8 @@ esac
AC_SUBST([root_sbindir])
AC_CONFIG_FILES([Makefile
+ contrib/Makefile
+ contrib/init-scripts/Makefile
doc/Makefile
doc/ldap/Makefile
doc/man/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 0000000..09c3763
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1,28 @@
+##
+## @file contrib/Makefile.am
+## @brief Process this file with automake to produce contrib/Makefile.in
+##
+
+##
+## Copyright 2011 Oracle. All rights reserved.
+##
+## This file is part of fedfs-utils.
+##
+## fedfs-utils is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2.0 as
+## published by the Free Software Foundation.
+##
+## fedfs-utils is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License version 2.0 for more details.
+##
+## You should have received a copy of the GNU General Public License
+## version 2.0 along with fedfs-utils. If not, see:
+##
+## http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+##
+
+SUBDIRS = init-scripts
+CLEANFILES = cscope.in.out cscope.out cscope.po.out
+DISTCLEANFILES = Makefile.in
diff --git a/contrib/init-scripts/Makefile.am b/contrib/init-scripts/Makefile.am
new file mode 100644
index 0000000..6136075
--- /dev/null
+++ b/contrib/init-scripts/Makefile.am
@@ -0,0 +1,28 @@
+##
+## @file contrib/init-scripts/Makefile.am
+## @brief Process this file with automake to produce contrib/init-scripts/Makefile.in
+##
+
+##
+## Copyright 2011 Oracle. All rights reserved.
+##
+## This file is part of fedfs-utils.
+##
+## fedfs-utils is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2.0 as
+## published by the Free Software Foundation.
+##
+## fedfs-utils is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License version 2.0 for more details.
+##
+## You should have received a copy of the GNU General Public License
+## version 2.0 along with fedfs-utils. If not, see:
+##
+## http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+##
+
+EXTRA_DIST = rpcfedfsd
+CLEANFILES = cscope.in.out cscope.out cscope.po.out
+DISTCLEANFILES = Makefile.in
diff --git a/contrib/init-scripts/rpcfedfsd b/contrib/init-scripts/rpcfedfsd
new file mode 100755
index 0000000..d2bb7fe
--- /dev/null
+++ b/contrib/init-scripts/rpcfedfsd
@@ -0,0 +1,121 @@
+#!/bin/bash
+#
+# rpcfedfsd Start up and shut down FedFS admin service
+#
+# chkconfig: 345 19 83
+# description: Starts user-level daemon for NFSv4 that handles \
+# FedFS administrative requests
+
+### BEGIN INIT INFO
+# Provides: rpcfedfsd
+# Required-Start: $network $syslog
+# Required-Stop: $network $syslog
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts the NFSv4 fedfsd daemon
+# Description: NFS is a popular protocol for file sharing across \
+# networks. This daemon processes FedFS administrative \
+# requests on NFSv4 exports.
+### END INIT INFO
+
+##
+## Copyright 2011 Oracle. All rights reserved.
+##
+## rpcfedfsd is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2.0 as
+## published by the Free Software Foundation.
+##
+## rpcfedfsd is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License version 2.0 for more details.
+##
+## A copy of the GNU General Public License version 2.0 is
+## available here:
+##
+## http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+##
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source networking configuration.
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
+
+# Check for, and source, configuration file; otherwise set defaults
+[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
+
+RETVAL=0
+prog="rpc.fedfsd"
+LOCKFILE=/var/lock/subsys/$prog
+uid=`id | cut -d\( -f1 | cut -d= -f2`
+
+case "$1" in
+ start|condstart)
+ # Check that networking is up.
+ [ "${NETWORKING}" != "yes" ] && exit 6
+
+ [ ! -x /usr/sbin/rpc.fedfsd ] && exit 5
+
+ # Only root can start the service
+ [ $uid -ne 0 ] && exit 4
+
+ # Make sure the daemon is not already running.
+ [ "$1" = "condstart" -a -n "`pidofproc $prog`" ] && {
+ killproc $prog "-SIGHUP" > /dev/null
+ exit 0
+ }
+ [ "$1" = "start" ] && {
+ if status $prog > /dev/null ; then
+ exit 0
+ fi
+ }
+ rm -f $LOCKFILE
+
+ echo -n $"Starting RPC fedfsd: "
+
+ # Start daemon.
+ daemon $prog ${RPCFEDFSDARGS}
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $LOCKFILE
+ ;;
+ stop)
+ # Only root can stop the service
+ [ $uid -ne 0 ] && exit 4
+
+ # Stop daemon.
+ echo -n $"Stopping RPC fedfsd: "
+ killproc $prog
+ RETVAL=$?
+ echo
+ rm -f $LOCKFILE
+ ;;
+ status)
+ status rpc.fedfsd
+ RETVAL=$?
+ ;;
+ restart|reload|force-reload)
+ $0 stop
+ $0 start
+ RETVAL=$?
+ ;;
+ condrestart|try-restart)
+ if [ -f $LOCKFILE ]; then
+ $0 restart
+ RETVAL=$?
+ fi
+ ;;
+ condstop)
+ if [ -f $LOCKFILE ]; then
+ $0 stop
+ RETVAL=$?
+ fi
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|force-reload|condstart|condrestart|try-restart|status|condstop}"
+ RETVAL=2
+ ;;
+esac
+
+exit $RETVAL
More information about the fedfs-utils-devel
mailing list