Browse Source

Adding redhat init/service files to start pimd

Added missing pimd.init (for RedHat/CentOS <= 6) and
pimd.service (for RedHat/CentOS >= 7)

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Martin Winter 4 years ago
parent
commit
fca2c24ff2
3 changed files with 87 additions and 1 deletions
  1. 1 1
      redhat/Makefile.am
  2. 72 0
      redhat/pimd.init
  3. 14 0
      redhat/pimd.service

+ 1 - 1
redhat/Makefile.am

@@ -3,4 +3,4 @@ EXTRA_DIST = bgpd.init bgpd.service isisd.init \
 	isisd.service ospf6d.init ospf6d.service ospfd.init ospfd.service \
 	quagga.logrotate quagga.pam quagga.pam.stack quagga.spec \
 	quagga.sysconfig ripd.init ripd.service ripngd.init ripngd.service \
-	watchquagga.init zebra.init zebra.service
+	watchquagga.init pimd.init pimd.service zebra.init zebra.service

+ 72 - 0
redhat/pimd.init

@@ -0,0 +1,72 @@
+#!/bin/bash
+# chkconfig: - 16 84
+# config: /etc/quagga/pimd.conf
+
+### BEGIN INIT INFO
+# Provides: pimd
+# Short-Description: PIM multicast routing engine
+# Description: PIM routing engine for use with Zebra
+### END INIT INFO
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# quagga command line options
+. /etc/sysconfig/quagga
+
+RETVAL=0
+PROG="pimd"
+cmd=pimd
+LOCK_FILE=/var/lock/subsys/pimd
+CONF_FILE=/etc/quagga/pimd.conf
+
+case "$1" in
+  start)
+	# Check that networking is up.
+	[ "${NETWORKING}" = "no" ] && exit 1
+
+	# The process must be configured first.
+	[ -f $CONF_FILE ] || exit 6
+	if [ `id -u` -ne 0 ]; then
+		echo $"Insufficient privilege" 1>&2
+		exit 4
+	fi
+
+	echo -n $"Starting $PROG: "
+	daemon $cmd -d $PIMD_OPTS -f $CONF_FILE
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch $LOCK_FILE
+	echo
+	;;
+  stop)
+	echo -n $"Shutting down $PROG: "
+	killproc $cmd
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
+	echo
+	;;
+  restart|reload|force-reload)
+	$0 stop
+	$0 start
+	RETVAL=$?
+	;;
+  condrestart|try-restart)
+	if [ -f $LOCK_FILE ]; then
+		$0 stop
+		$0 start
+	fi
+	RETVAL=$?
+	;;
+  status)
+	status $cmd
+	RETVAL=$?
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+	exit 2
+esac
+
+exit $RETVAL

+ 14 - 0
redhat/pimd.service

@@ -0,0 +1,14 @@
+[Unit]
+Description=PIM multicast routing engine
+BindTo=zebra.service
+After=syslog.target network.target zebra.service
+ConditionPathExists=/etc/quagga/pimd.conf
+
+[Service]
+Type=forking
+EnvironmentFile=/etc/sysconfig/quagga
+ExecStart=/usr/sbin/pimd -d $PIMD_OPTS -f /etc/quagga/pimd.conf
+Restart=on-abort
+
+[Install]
+WantedBy=network.target