* [Buildroot] [PATCH v3 1/1] package/collectd: add init script for SysV
@ 2019-10-31 20:28 Asaf Kahlon
2019-11-04 0:50 ` Carlos Santos
2020-04-13 20:34 ` Thomas Petazzoni
0 siblings, 2 replies; 3+ messages in thread
From: Asaf Kahlon @ 2019-10-31 20:28 UTC (permalink / raw)
To: buildroot
Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
---
v2->v3: fix Carlos comments.
---
package/collectd/S90collectd | 51 ++++++++++++++++++++++++++++++++++++
package/collectd/collectd.mk | 5 ++++
2 files changed, 56 insertions(+)
create mode 100644 package/collectd/S90collectd
diff --git a/package/collectd/S90collectd b/package/collectd/S90collectd
new file mode 100644
index 0000000000..cf11c7b383
--- /dev/null
+++ b/package/collectd/S90collectd
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+DAEMON="collectd"
+EXEC="/usr/sbin/$DAEMON"
+PIDFILE="/var/run/$DAEMON.pid"
+COLLECTD_ARGS=""
+
+# shellcheck source=/dev/null
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+ printf 'Starting %s: ' "$DAEMON"
+ # shellcheck disable=SC2086 # we need the word splitting
+ start-stop-daemon -S -q -p "$PIDFILE" -x "$EXEC" \
+ -- $COLLECTD_ARGS
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ return "$status"
+}
+
+stop() {
+ printf 'Stopping %s: ' "$DAEMON"
+ start-stop-daemon -K -q -p "$PIDFILE"
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ return "$status"
+}
+
+restart() {
+ stop
+ sleep 1
+ start
+}
+
+case "$1" in
+ start|stop|restart)
+ "$1";;
+ reload)
+ restart;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
+esac
diff --git a/package/collectd/collectd.mk b/package/collectd/collectd.mk
index 820547b511..9504b122d5 100644
--- a/package/collectd/collectd.mk
+++ b/package/collectd/collectd.mk
@@ -234,4 +234,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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH v3 1/1] package/collectd: add init script for SysV
2019-10-31 20:28 [Buildroot] [PATCH v3 1/1] package/collectd: add init script for SysV Asaf Kahlon
@ 2019-11-04 0:50 ` Carlos Santos
2020-04-13 20:34 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Carlos Santos @ 2019-11-04 0:50 UTC (permalink / raw)
To: buildroot
On Thu, Oct 31, 2019 at 5:29 PM Asaf Kahlon <asafka7@gmail.com> wrote:
>
> Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
> ---
> v2->v3: fix Carlos comments.
> ---
> package/collectd/S90collectd | 51 ++++++++++++++++++++++++++++++++++++
> package/collectd/collectd.mk | 5 ++++
> 2 files changed, 56 insertions(+)
> create mode 100644 package/collectd/S90collectd
>
> diff --git a/package/collectd/S90collectd b/package/collectd/S90collectd
> new file mode 100644
> index 0000000000..cf11c7b383
> --- /dev/null
> +++ b/package/collectd/S90collectd
> @@ -0,0 +1,51 @@
> +#!/bin/sh
> +
> +DAEMON="collectd"
> +EXEC="/usr/sbin/$DAEMON"
> +PIDFILE="/var/run/$DAEMON.pid"
> +COLLECTD_ARGS=""
> +
> +# shellcheck source=/dev/null
> +[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
> +
> +start() {
> + printf 'Starting %s: ' "$DAEMON"
> + # shellcheck disable=SC2086 # we need the word splitting
> + start-stop-daemon -S -q -p "$PIDFILE" -x "$EXEC" \
> + -- $COLLECTD_ARGS
> + status=$?
> + if [ "$status" -eq 0 ]; then
> + echo "OK"
> + else
> + echo "FAIL"
> + fi
> + return "$status"
> +}
> +
> +stop() {
> + printf 'Stopping %s: ' "$DAEMON"
> + start-stop-daemon -K -q -p "$PIDFILE"
> + status=$?
> + if [ "$status" -eq 0 ]; then
> + echo "OK"
> + else
> + echo "FAIL"
> + fi
> + return "$status"
> +}
> +
> +restart() {
> + stop
> + sleep 1
> + start
> +}
> +
> +case "$1" in
> + start|stop|restart)
> + "$1";;
> + reload)
> + restart;;
> + *)
> + echo "Usage: $0 {start|stop|restart|reload}"
> + exit 1
> +esac
> diff --git a/package/collectd/collectd.mk b/package/collectd/collectd.mk
> index 820547b511..9504b122d5 100644
> --- a/package/collectd/collectd.mk
> +++ b/package/collectd/collectd.mk
> @@ -234,4 +234,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
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Reviewed-by: Carlos Santos <unixmania@gmail.com>
Tested-by: Carlos Santos <unixmania@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH v3 1/1] package/collectd: add init script for SysV
2019-10-31 20:28 [Buildroot] [PATCH v3 1/1] package/collectd: add init script for SysV Asaf Kahlon
2019-11-04 0:50 ` Carlos Santos
@ 2020-04-13 20:34 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2020-04-13 20:34 UTC (permalink / raw)
To: buildroot
On Thu, 31 Oct 2019 22:28:59 +0200
Asaf Kahlon <asafka7@gmail.com> wrote:
> Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
> ---
> v2->v3: fix Carlos comments.
> ---
> package/collectd/S90collectd | 51 ++++++++++++++++++++++++++++++++++++
> package/collectd/collectd.mk | 5 ++++
> 2 files changed, 56 insertions(+)
> create mode 100644 package/collectd/S90collectd
Applied to master, thanks. Thanks a lot Carlos for the review and
testing!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-13 20:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-31 20:28 [Buildroot] [PATCH v3 1/1] package/collectd: add init script for SysV Asaf Kahlon
2019-11-04 0:50 ` Carlos Santos
2020-04-13 20:34 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox