summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/Makefile.am8
-rw-r--r--etc/miavd.in103
2 files changed, 110 insertions, 1 deletions
diff --git a/etc/Makefile.am b/etc/Makefile.am
index 507c8e1..60845db 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -1,12 +1,15 @@
EXTRA_DIST = \
+ miavd.in \
miav.conf \
miavd.conf \
multicast.conf
sysconfdir=${prefix}/etc/miav
-
dist_sysconf_DATA =
+initddir=${prefix}/etc/init.d
+dist_initd_DATA =
+
if WITH_CLIENT
dist_sysconf_DATA += \
miav.conf
@@ -16,4 +19,7 @@ if WITH_SERVER
dist_sysconf_DATA += \
miavd.conf \
multicast.conf
+
+dist_initd_DATA += \
+ miavd
endif
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
+