summaryrefslogtreecommitdiffstats
path: root/init-script
diff options
context:
space:
mode:
authorLars Müller2008-03-01 19:30:38 +0100
committerLars Müller2008-03-01 19:30:38 +0100
commit93b9103f7383d400616d222606c294e07b16e1aa (patch)
tree611a39f7bc1d1dd5a4335157ef95c101d64dddc8 /init-script
downloaddnbd2-93b9103f7383d400616d222606c294e07b16e1aa.tar.gz
dnbd2-93b9103f7383d400616d222606c294e07b16e1aa.tar.xz
dnbd2-93b9103f7383d400616d222606c294e07b16e1aa.zip
Import dnbd* from the former openslx-contrib repo as of revision 92.
openslx-contrib is currently read only and will get removed in some days. git-svn-id: http://svn.openslx.org/svn/openslx/contrib/dnbd2/trunk@1592 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'init-script')
-rw-r--r--init-script/Makefile10
-rwxr-xr-xinit-script/dnbd284
2 files changed, 94 insertions, 0 deletions
diff --git a/init-script/Makefile b/init-script/Makefile
new file mode 100644
index 0000000..b523ffc
--- /dev/null
+++ b/init-script/Makefile
@@ -0,0 +1,10 @@
+#
+# init-script/Makefile
+#
+
+all:
+
+install:
+ cp dnbd2 /etc/init.d/
+
+clean:
diff --git a/init-script/dnbd2 b/init-script/dnbd2
new file mode 100755
index 0000000..e9a67ab
--- /dev/null
+++ b/init-script/dnbd2
@@ -0,0 +1,84 @@
+#! /bin/bash
+#
+### BEGIN INIT INFO
+# Provides: dnbd2
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: starts and stops the DNBD2 server.
+# Description: DNDB2 is a Distributed Network Block Device for
+# diskless clients in unicast networks.
+### END INIT INFO
+#
+# Author: Vito Di Leo <dileo@informatik.uni-freiburg.de>
+
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+USER=dnbd2
+SERVER_NAME=dnbd2-server
+SERVER_DESC="DNBD2 Server"
+
+[ -x "`which $SERVER_NAME`" ] || exit 0
+
+. /lib/lsb/init-functions
+
+if ! (id $USER >/dev/null 2>&1) ; then
+ log_failure_msg "Please create system user $USER."
+ exit 0
+fi
+
+if [ ! -x /usr/bin/pkill ] ; then
+ log_failure_msg "Please install pkill."
+ exit 0
+fi
+
+if [ ! -x /usr/bin/sudo ] ; then
+ log_failure_msg "Please install sudo."
+ exit 0
+fi
+
+
+case "$1" in
+ start)
+ for FILE in `ls /etc/dnbd2/servers/* 2>/dev/null` ; do
+ log_begin_msg "Starting $SERVER_DESC ($FILE)..."
+ sudo -u $USER $SERVER_NAME $FILE
+ log_end_msg $?
+ done
+ ;;
+
+ stop)
+ log_begin_msg "Stoping $SERVER_DESC"s...
+ pkill -u $USER $SERVER_NAME
+ log_end_msg 0
+ ;;
+
+ reload|force-reload)
+ log_begin_msg "Reloading $SERVER_DESC"s...
+ pkill -SIGHUP -u $USER $SERVER_NAME
+ log_end_msg 0
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ status)
+ PIDS=`pgrep -u $USER $SERVER_NAME`
+ if [ -n "$PIDS" ] ; then
+ echo $SERVER_NAME running on pids $PIDS
+ exit 0
+ fi
+ echo $SERVER_NAME not running.
+ exit 3
+ ;;
+
+ *)
+ echo "Usage: dnbd2 {start|stop|restart|reload|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+exit 0