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

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
---
 package/collectd/S90collectd | 33 +++++++++++++++++++++++++++++++++
 package/collectd/collectd.mk |  5 +++++
 2 files changed, 38 insertions(+)
 create mode 100644 package/collectd/S90collectd

diff --git a/package/collectd/S90collectd b/package/collectd/S90collectd
new file mode 100644
index 0000000000..5caff17238
--- /dev/null
+++ b/package/collectd/S90collectd
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+start() {
+	printf "Starting collectd... "
+	/usr/sbin/collectd
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+	printf "Stopping collectd... "
+	pkill collectd
+	[ $? = 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  5:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26  5:50 Asaf Kahlon [this message]
2019-10-26  6:58 ` [Buildroot] [PATCH 1/1] package/collectd: add init script for SysV Thomas Petazzoni
2019-10-26  7:20   ` Asaf Kahlon

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=20191026055013.13174-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox