aboutsummaryrefslogtreecommitdiff
path: root/foolsm.init
diff options
context:
space:
mode:
authorLucas Castro <lucas@gnuabordo.com.br>2024-01-11 12:07:59 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2024-06-05 19:00:29 -0300
commita4676d0e2e75ebcadfb2c947f7a1fa39b8aea246 (patch)
tree635a07582f6f525318bfed44c38bda264f65f28c /foolsm.init
parentca0774165e52cc2c08a6bac98ed3f8622842930e (diff)
New upstream version 1.0.8
Diffstat (limited to 'foolsm.init')
-rw-r--r--foolsm.init97
1 files changed, 97 insertions, 0 deletions
diff --git a/foolsm.init b/foolsm.init
new file mode 100644
index 0000000..e9e12ea
--- /dev/null
+++ b/foolsm.init
@@ -0,0 +1,97 @@
+#!/bin/sh
+#
+# /etc/init.d/foolsm
+#
+# This shellscript takes care of starting and stopping foolsm.
+#
+# chkconfig: - 79 31
+# description: Foolsm, Link Status Monitor
+#
+### BEGIN INIT INFO
+# Provides: foolsm
+# Required-Start: $network $syslog
+# Required-Stop:
+# Default-Stop: 0 1 6
+# Short-Description: Foolsm - link status monitor
+# Description: Foolsm is the link status monitor
+# Foolsm can ping multiple targets and when up or down event happens
+# it will execute user configured external script so it can be used
+# as poor man's routing protocol.
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 0
+
+CONFIGFILE="/etc/foolsm/foolsm.conf"
+PIDFILE="/var/run/foolsm.pid"
+
+[ -f /etc/sysconfig/foolsm ] && . /etc/sysconfig/foolsm
+[ -x /usr/sbin/foolsm ] || exit 0
+
+RETVAL=0
+
+start() {
+ echo -n $"Starting foolsm: "
+ daemon --pidfile=${PIDFILE} /usr/sbin/foolsm --config $CONFIGFILE --pidfile $PIDFILE
+ RETVAL=$?
+ /bin/usleep 10000
+ echo
+ [ $RETVAL = 0 ] && touch /var/lock/subsys/foolsm
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping foolsm: "
+ killproc /usr/sbin/foolsm
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && rm -f /var/lock/subsys/foolsm
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo -n $"Reloading foolsm: "
+ killproc -p ${PIDFILE} /usr/sbin/foolsm -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/foolsm ] && restart
+ ;;
+ status)
+ status -p ${PIDFILE} foolsm
+ RETVAL=$?
+ ;;
+ *)
+ echo "Usage: foolsm {start|stop|restart|condrestart|status}"
+ RETVAL=2
+esac
+
+exit $RETVAL