Added initial unfs3 sources for version 0.9.22+dfsg-1maemo2
[unfs3] / unfs3 / unfsd.init
diff --git a/unfs3/unfsd.init b/unfs3/unfsd.init
new file mode 100755 (executable)
index 0000000..0f66d2a
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+# -*- mode: shell-script; coding: UTF-8 -*-
+#
+# chkconfig: 235 99 10
+# description: Start or stop the unfs3 server
+#
+### BEGIN INIT INFO
+# Provides: unfsd
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Description: Start or stop the unfs3 server
+### END INIT INFO
+
+description="unfs3 NFS server"
+lockfile="/var/lock/subsys/unfsd"
+pidfile="/var/run/unfsd.pid"
+
+
+case "$1" in
+    'start')
+        echo "Starting" ${description}
+        /usr/sbin/unfsd -i ${pidfile}
+        RETVAL=$?
+        if [ "${RETVAL}" = "0" ]; then
+            touch ${lockfile} >/dev/null 2>&1
+        fi
+        ;;
+    'stop')
+        echo "Shutting down" ${description}
+        if [ -s ${pidfile} ]; then
+            pid=`cat ${pidfile}`
+            kill -TERM ${pid} 2>/dev/null
+            sleep 2
+            if kill -0 ${pid} 2>/dev/null; then
+                kill -KILL ${pid}
+            fi
+        fi
+        rm -f ${lockfile} ${pidfile}
+        ;;
+    'status')
+        if [ -s ${pidfile} ]; then
+                pid=`cat ${pidfile}`
+                if kill -0 ${pid} 2>/dev/null; then
+                    echo "${description} (pid ${pid}) is running"
+                    RETVAL=0
+               else
+                    echo "${description} is stopped"
+                    RETVAL=1
+               fi
+       else
+            echo "${description} is stopped"
+            RETVAL=1
+       fi
+       ;;
+    'restart')
+       /etc/init.d/unfsd stop && /etc/init.d/unfsd start
+       RETVAL=$?
+       ;;
+    'condrestart')
+       [ -f /var/lock/subsys/unfsd ] && /etc/init.d/unfsd stop && /etc/init.d/unfsd start
+       RETVAL=$?
+       ;;
+    *)
+       echo "Usage: $0 {start|stop|restart|condrestart|status}"
+       RETVAL=1
+       ;;
+esac
+exit $RETVAL
+