summaryrefslogtreecommitdiff
path: root/net-misc/ip-sentinel/files/ip-sentinel.init
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-misc/ip-sentinel/files/ip-sentinel.init
reinit the tree, so we can have metadata
Diffstat (limited to 'net-misc/ip-sentinel/files/ip-sentinel.init')
-rw-r--r--net-misc/ip-sentinel/files/ip-sentinel.init49
1 files changed, 49 insertions, 0 deletions
diff --git a/net-misc/ip-sentinel/files/ip-sentinel.init b/net-misc/ip-sentinel/files/ip-sentinel.init
new file mode 100644
index 000000000000..923cedeac13c
--- /dev/null
+++ b/net-misc/ip-sentinel/files/ip-sentinel.init
@@ -0,0 +1,49 @@
+#!/sbin/openrc-run
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+CFG_FILE="/etc/ip-sentinel.cfg"
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ ! -f "${CFG_FILE}" ] ; then
+ eerror "File ${CFG_FILE} does not exists!"
+ return 1
+ fi
+
+ if [ -n "${CHROOT}" ] ; then
+ local_opts="--user ipsentinel --group ipsentinel -r ${CHROOT}"
+ else
+ local_opts="--user ipsentinel --group ipsentinel -r /"
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting ip-sentinel..."
+ start-stop-daemon --start --quiet --exec /usr/sbin/ip-sentinel -- --ipfile ${CFG_FILE} ${local_opts} $OPTS $IFACE &
+ eend $? "Failed to start ip-sentinel"
+}
+
+stop() {
+ ebegin "Stoping ip-sentinel..."
+ start-stop-daemon --stop --quiet --pidfile /var/run/ip-sentinel.run
+ eend $? "Failed to stop ip-sentinel"
+}
+
+restart () {
+ svc_stop
+ echo "Please, wait while child process quit..."
+ while `ps aux | grep -v 'init.d' | grep [i]p-sentinel >/dev/null`
+ do
+ echo -n ". "
+ sleep 1
+ done
+ echo "[Done]"
+ svc_start
+}
+