From 0ef1a95b220c7e110da950e5cc544c50c25b1bc6 Mon Sep 17 00:00:00 2001
From: Li xin <lixin.fnst@cn.fujitsu.com>
Date: Tue, 18 Nov 2014 18:11:56 +0900
Subject: [PATCH 4/5] rarpd.init : add new init file

Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
---
Upstream-Status: Pending

 rarpd.init | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 rarpd.init

diff --git a/rarpd.init b/rarpd.init
new file mode 100644
index 0000000..efcf825
--- /dev/null
+++ b/rarpd.init
@@ -0,0 +1,96 @@
+#!/bin/bash
+#
+#	/etc/init.d/rarpd
+#
+# Starts the rarpd daemon
+#
+# chkconfig: - 82 16
+# description: Server Reverse Address Resolution Protocol requests.
+# processname: rarpd
+
+### BEGIN INIT INFO
+# Provides: rarpd
+# Required-Start: $syslog $network
+# Required-Stop:  $syslog $network
+# Default-Start:
+# Default-Stop: 0 1 2 3 4 5 6
+# Short-Description: start and stop rarpd
+# Description: RARP (Reverse Address Resolution Protocol) is a protocol \
+#              which allows individual devices on an IP network to get \
+#              their own IP addresses from the RARP server. \
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+# Read the config file if exists
+if [ -f /etc/sysconfig/rarpd ]; then
+ . /etc/sysconfig/rarpd
+fi
+
+RETVAL=0
+prog="rarpd"
+
+
+start() {
+    #if these files don't exist rarpd can't work
+    test -x /usr/sbin/rarpd -a -f /etc/ethers || exit 6
+	# Check if rarpd is already running
+	#if [ ! -f /var/lock/subsys/rarpd ]; then
+    status rarpd;
+    if [ $? -ne 0 ]; then
+	    echo -n $"Starting $prog: "
+	    daemon /usr/sbin/rarpd $OPTIONS $INTERFACE
+	    RETVAL=$?
+	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rarpd
+	    echo
+	fi
+	return $RETVAL
+}
+
+stop() {
+	echo -n $"Stopping $prog: "
+	killproc /usr/sbin/rarpd
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rarpd
+	echo
+	return $RETVAL
+}
+reload() {
+    RETVAL=3
+}
+
+#
+#	See how we were called.
+#
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  reload)
+    reload
+    ;;
+  force-reload|restart)
+    stop
+	start
+	;;
+  condrestart)
+	if [ -f /var/lock/subsys/rarpd ]; then
+	    stop
+	    start
+	fi
+	;;
+  status)
+	status rarpd
+	RETVAL=$?
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|restart|condrestart|reload|status|force-reload}"
+	RETVAL=2
+    
+esac
+
+exit $RETVAL
-- 
1.8.4.2

