summaryrefslogtreecommitdiff
path: root/etc/miavd.in
diff options
context:
space:
mode:
Diffstat (limited to 'etc/miavd.in')
-rw-r--r--etc/miavd.in103
1 files changed, 103 insertions, 0 deletions
diff --git a/etc/miavd.in b/etc/miavd.in
new file mode 100644
index 0000000..f36330b
--- /dev/null
+++ b/etc/miavd.in
@@ -0,0 +1,103 @@
+#!/bin/bash
+#
+# chkconfig: - 65 34
+# description: Start MIaV server
+
+### BEGIN INIT INFO
+# Provides: miavd
+# Required-Start: $network
+# Should-Start: $syslog $named
+# Short-Description: start miav server
+# Description: starts the miav server
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+prog=miavd
+lockfile="@prefix@/var/lock/subsys/$prog"
+_CONF="@prefix@/etc/miav.conf"
+_BIN="@exec_prefix@/bin/$prog"
+_LOG="@prefix@/var/log/$prog/$prog.log"
+_PID="@prefix@/var/run/$prog.pid"
+
+start() {
+# [ "$EUID" != "0" ] && exit 4
+ [ "$NETWORKING" = "no" ] && exit 1
+ [ -x "$_BIN" ] || exit 5
+
+ echo -n $"$prog: Starting miavd server: "
+
+ if [ -f $lockfile ]
+ then
+ echo -n "Already started"
+ failure
+ echo
+ return 4
+ fi
+
+ export LD_LIBRARY_PATH=$_PREFIX/lib
+# $_BIN --pidfile ${_PID} --config ${_CONF} -D +all --logfile ${_LOG} &> /dev/null
+ $_BIN --config ${_CONF} -D +all &> /dev/null
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && success || failure
+ echo
+ if [ $RETVAL -eq 0 ]; then
+ touch $lockfile
+ fi
+ return $RETVAL
+}
+
+#status() {
+# [ -f $lockfile ] || return 3
+# status -p ${_PID} miavd
+# status miavd
+#}
+
+stop() {
+ echo -n $"$prog: Stopping miav server: "
+ if [ ! -f $lockfile ]
+ then
+ echo -n "Not started"
+ failure
+ echo
+ exit 4
+ fi
+# [ "$EUID" != "0" ] && exit 4
+# kill -s INT $(cat ${_PID})
+ killall -9 miavd
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]
+ then
+ rm -f $lockfile
+ success
+ else
+ failure
+ fi
+ echo
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status miavd
+ ;;
+ restart|force-reload)
+ stop
+ start
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|force-reload}"
+ exit 2
+esac
+