All of lore.kernel.org
 help / color / mirror / Atom feed
From: Asaf Kahlon <asafka7@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/1] package/collectd: add init script for SysV
Date: Sat, 26 Oct 2019 10:19:04 +0300	[thread overview]
Message-ID: <20191026071905.23036-1-asafka7@gmail.com> (raw)

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
---
v1->v2: use start-stop-daemon
---
 package/collectd/S90collectd | 36 ++++++++++++++++++++++++++++++++++++
 package/collectd/collectd.mk |  5 +++++
 2 files changed, 41 insertions(+)
 create mode 100644 package/collectd/S90collectd

diff --git a/package/collectd/S90collectd b/package/collectd/S90collectd
new file mode 100644
index 0000000000..3c5af17674
--- /dev/null
+++ b/package/collectd/S90collectd
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+DAEMON="collectd"
+PIDFILE="/var/run/$DAEMON.pid"
+
+start() {
+	printf "Starting collectd... "
+	start-stop-daemon -b -m -S -q -p $PIDFILE -x "/usr/sbin/$DAEMON"
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+	printf "Stopping collectd... "
+	start-stop-daemon -K -q -p $PIDFILE
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+restart() {
+	stop
+	start
+}
+
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart|reload)
+	restart
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
diff --git a/package/collectd/collectd.mk b/package/collectd/collectd.mk
index 5d94dec46d..1bce196e7e 100644
--- a/package/collectd/collectd.mk
+++ b/package/collectd/collectd.mk
@@ -218,4 +218,9 @@ define COLLECTD_INSTALL_INIT_SYSTEMD
 		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/collectd.service
 endef
 
+define COLLECTD_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/collectd/S90collectd \
+		$(TARGET_DIR)/etc/init.d/S90collectd
+endef
+
 $(eval $(autotools-package))
-- 
2.20.1

             reply	other threads:[~2019-10-26  7:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26  7:19 Asaf Kahlon [this message]
2019-10-26  7:19 ` [Buildroot] [PATCH v2 1/1] package/uvw: new package Asaf Kahlon
2019-10-26 12:31   ` Gilles Talis
2019-10-26 13:39     ` Asaf Kahlon
2019-10-26  7:23 ` [Buildroot] [PATCH v2 1/1] package/collectd: add init script for SysV Thomas Petazzoni
2019-10-26  7:31   ` Asaf Kahlon
2019-10-28 18:37 ` Carlos Santos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191026071905.23036-1-asafka7@gmail.com \
    --to=asafka7@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.