Skip to contentSkip to conversation

package/syrepo: fix SysV init script

PATCH New Heiko Thiery 2 participants 2 messages May 27, 2020 – May 31, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/syrepo: fix SysV init script

The current script (S51sysrepo-plugind) is not able to stop the daemon.

Possible options to fix the problem:

A) By adding the "-m -p $PIDFILE" option to start the pid file will be created but it will not contain the correct PID used by the daemon. This is obviously because the daemon forks.
B) By not starting the daemon in background (sysrepo-plugind -d) and let do it by start-stop-daemon with "-b" option. But then the log messages of the daemon will not longer ends in the syslog but to stderr.
C) Start the daemon without a pidfile and stop the daemon with the "-x" option.

The only valid option is C to fix that.

---
changes v1 -> v2:
Add a proper commit message.

---
 package/sysrepo/S51sysrepo-plugind | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
package/sysrepo/S51sysrepo-plugind +1 -2
index 74b68396bf..9e15da59f9 100644
@@ -1,7 +1,6 @@
 #!/bin/sh
 
 DAEMON="sysrepo-plugind"
-PIDFILE="/var/run/$DAEMON.pid"
 
 SYSREPO_PLUGIND_ARGS=""
 
@@ -23,7 +22,7 @@ start() {
 
 stop() {
 	printf 'Stopping %s: ' "$DAEMON"
-	start-stop-daemon -K -q -p $PIDFILE
+	start-stop-daemon -K -q -x "/usr/bin/$DAEMON"
 	status=$?
 	if [ "$status" -eq 0 ]; then
 		echo "OK"
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 package/syrepo: fix SysV init script

Heiko, All,

On 2020-05-27 09:11 +0200, Heiko Thiery spake thusly:

Quoted 13 lines

The current script (S51sysrepo-plugind) is not able to stop the daemon.

Possible options to fix the problem:

A) By adding the "-m -p $PIDFILE" option to start the pid file will be created but it will not contain the correct PID used by the daemon. This is obviously because the daemon forks.
B) By not starting the daemon in background (sysrepo-plugind -d) and let do it by start-stop-daemon with "-b" option. But then the log messages of the daemon will not longer ends in the syslog but to stderr.
C) Start the daemon without a pidfile and stop the daemon with the "-x" option.

Quoted 3 lines

The only valid option is C to fix that.

Applied to master, after fixing the typo in the title, and see below...

Quoted 21 lines

---
changes v1 -> v2:
Add a proper commit message.

---
 package/sysrepo/S51sysrepo-plugind | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
package/sysrepo/S51sysrepo-plugind +0 -1
index 74b68396bf..9e15da59f9 100644
@@ -1,7 +1,6 @@
 #!/bin/sh
 
 DAEMON="sysrepo-plugind"
-PIDFILE="/var/run/$DAEMON.pid"
 
 SYSREPO_PLUGIND_ARGS=""
 

package/sysrepo/S51sysrepo-plugind start() { · line 25

Quoted 5 lines
package/sysrepo/S51sysrepo-plugind +1 -1
@@ -23,7 +22,7 @@ start() {
 
 stop() {
 	printf 'Stopping %s: ' "$DAEMON"
-	start-stop-daemon -K -q -p $PIDFILE
+	start-stop-daemon -K -q -x "/usr/bin/$DAEMON"

I've introduced EXECUTABLE to hold that path, and used it consistently in the start() and stop().

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 10 lines
package/sysrepo/S51sysrepo-plugind +0 -0
 	status=$?
 	if [ "$status" -eq 0 ]; then
 		echo "OK"
Signature · 6 lines
2.20.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'