Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/dnsmasq: provide pidfile along with -x flag
@ 2023-06-16  1:23 Konstantin Menyaev via buildroot
  2023-07-01 20:44 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Menyaev via buildroot @ 2023-06-16  1:23 UTC (permalink / raw)
  To: buildroot; +Cc: Konstantin Menyaev, sdfw_system_team

From: Konstantin Menyaev <KAMenyaev@sberdevices.ru>

Use pidfile for more accurate process match.
Useful in multiple process instances.

Signed-off-by: Konstantin Menyaev <KAMenyaev@sberdevices.ru>
---
 package/dnsmasq/S80dnsmasq | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/package/dnsmasq/S80dnsmasq b/package/dnsmasq/S80dnsmasq
index b052259e87..b2cd56adef 100644
--- a/package/dnsmasq/S80dnsmasq
+++ b/package/dnsmasq/S80dnsmasq
@@ -1,16 +1,21 @@
 #!/bin/sh
 
+NAME="dnsmasq"
+DAEMON="/usr/sbin/$NAME"
+PIDFILE="/var/run/$NAME.pid"
+
 [ -f /etc/dnsmasq.conf ] || exit 0
 
 case "$1" in
 	start)
 		printf "Starting dnsmasq: "
-		start-stop-daemon -S -x /usr/sbin/dnsmasq
+		start-stop-daemon -S -p "$PIDFILE" -x "$DAEMON" -- \
+			--pid-file="$PIDFILE"
 		[ $? = 0 ] && echo "OK" || echo "FAIL"
 		;;
 	stop)
 		printf "Stopping dnsmasq: "
-		start-stop-daemon -K -q -x /usr/sbin/dnsmasq
+		start-stop-daemon -K -q -p "$PIDFILE" -x "$DAEMON"
 		[ $? = 0 ] && echo "OK" || echo "FAIL"
 		;;
 	restart|reload)
-- 
2.40.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/dnsmasq: provide pidfile along with -x flag
  2023-06-16  1:23 [Buildroot] [PATCH 1/1] package/dnsmasq: provide pidfile along with -x flag Konstantin Menyaev via buildroot
@ 2023-07-01 20:44 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-07-01 20:44 UTC (permalink / raw)
  To: Konstantin Menyaev via buildroot; +Cc: KAMenyaev, sdfw_system_team

Hello Konstantin,

Thanks for your contribution. See below for some feedback.

On Fri, 16 Jun 2023 04:23:24 +0300
Konstantin Menyaev via buildroot <buildroot@buildroot.org> wrote:

> From: Konstantin Menyaev <KAMenyaev@sberdevices.ru>
> 
> Use pidfile for more accurate process match.
> Useful in multiple process instances.
> 
> Signed-off-by: Konstantin Menyaev <KAMenyaev@sberdevices.ru>
> ---
>  package/dnsmasq/S80dnsmasq | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/package/dnsmasq/S80dnsmasq b/package/dnsmasq/S80dnsmasq
> index b052259e87..b2cd56adef 100644
> --- a/package/dnsmasq/S80dnsmasq
> +++ b/package/dnsmasq/S80dnsmasq
> @@ -1,16 +1,21 @@
>  #!/bin/sh
>  
> +NAME="dnsmasq"
> +DAEMON="/usr/sbin/$NAME"
> +PIDFILE="/var/run/$NAME.pid"

This is not correct, as it doesn't match the coding style documented at
https://nightly.buildroot.org/#adding-packages-start-script. I've
therefore changed this to match the expected coding style, which
allowed to drop the ignored check-package warning from
.checkpackageignore about "Variables".

See the final commit at:

  https://gitlab.com/buildroot.org/buildroot/-/commit/0c4c7da2f33cd701f614709e85a097a8751d81a4

I hope I didn't mess up the script while doing this.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-01 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16  1:23 [Buildroot] [PATCH 1/1] package/dnsmasq: provide pidfile along with -x flag Konstantin Menyaev via buildroot
2023-07-01 20:44 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox