Skip to contentSkip to conversation

package/collectd: add init script for SysV

PATCH Superseded Asaf Kahlon 2 participants 3 messages Oct 26, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/collectd: add init script for SysV

---
 package/collectd/S90collectd | 33 +++++++++++++++++++++++++++++++++
 package/collectd/collectd.mk |  5 +++++
 2 files changed, 38 insertions(+)
 create mode 100644 package/collectd/S90collectd
package/collectd/S90collectd new file +33 -0
new file mode 100644
index 0000000000..5caff17238
@@ -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 $?
package/collectd/collectd.mk +5 -0
index 5d94dec46d..1bce196e7e 100644
@@ -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))
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/collectd: add init script for SysV

Quoted 13 lines · On Sat, 26 Oct 2019 08:50:13 +0300 Asaf Kahlon <[email protected]> wrote:
---
 package/collectd/S90collectd | 33 +++++++++++++++++++++++++++++++++
 package/collectd/collectd.mk |  5 +++++
 2 files changed, 38 insertions(+)
 create mode 100644 package/collectd/S90collectd
package/collectd/S90collectd new file +0 -0
new file mode 100644
index 0000000000..5caff17238

package/collectd/S90collectd line 5

Quoted 5 lines
package/collectd/S90collectd new file +5 -0
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+start() {
+	printf "Starting collectd... "
+	/usr/sbin/collectd

I think we like to use start-stop-daemon in our init scripts. Any reason why you're not using start-stop-daemon here ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/collectd: add init script for SysV

Hello,

Quoted 11 lines · Thomas Petazzoni
Quoted 7 lines · On Sat, 26 Oct 2019 08:50:13 +0300 Asaf Kahlon <[email protected]> wrote:
---
 package/collectd/S90collectd | 33 +++++++++++++++++++++++++++++++++
 package/collectd/collectd.mk |  5 +++++
 2 files changed, 38 insertions(+)
 create mode 100644 package/collectd/S90collectd
Quoted 14 lines

package/collectd/S90collectd line 5

Quoted 11 lines
package/collectd/S90collectd new file +5 -0
new file mode 100644
index 0000000000..5caff17238
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+start() {
+     printf "Starting collectd... "
+     /usr/sbin/collectd

I think we like to use start-stop-daemon in our init scripts. Any reason why you're not using start-stop-daemon here ?

Nothing special, I sent a v2.

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Regards,
Asaf.