summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-06-18 10:41:14 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-06-18 10:41:14 +0200
commit6185d6e4930342de18d7f44ec3aebd611c53bfba (patch)
tree94e9e814070a70519ca593c325cd8831cbe1abff
parent92acb8a9318c3010ecc4d7bd6cd1aa8460fb191e (diff)
Add init.d script for centos.
-rw-r--r--configure.ac2
-rw-r--r--etc/Makefile.am8
-rw-r--r--etc/miavd.in103
3 files changed, 112 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 9180756..0bfcf6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,6 +171,8 @@ if test x$with_server != xno && test -z "$SERVER"; then
LIBS="$tmp_LIBS"
AC_SUBST(LAME_CFLAGS)
AC_SUBST(LAME_LIBS)
+
+ AC_CONFIG_FILES(etc/miavd)
else
AC_MSG_WARN([*** Building without server support!])
fi
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
+