diff mbox series

[bug#38240,v3] services: sysctl: Make service one-shot.

Message ID 20191119100053.GP15074@E5400
State Accepted
Headers show
Series [bug#38240,v3] services: sysctl: Make service one-shot. | expand

Commit Message

Efraim Flashner Nov. 19, 2019, 10 a.m. UTC
Here's yet another newer version :)

Comments

Ludovic Courtès Nov. 20, 2019, 2:10 p.m. UTC | #1
Hello!

Efraim Flashner <efraim@flashner.co.il> skribis:

> From 796bf6d1b58d675b04198e536bae62552b16da75 Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <efraim@flashner.co.il>
> Date: Sat, 16 Nov 2019 23:33:31 +0200
> Subject: [PATCH] services: sysctl: Make service one-shot.
>
> * gnu/services/sysctl.scm (sysctl-shepherd-service): Adjust shepherd
> service to use the 'one-shot?' keyword. Remove 'stop' command. Remove
> 'respawn' option.
> ---
>  gnu/services/sysctl.scm | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/services/sysctl.scm b/gnu/services/sysctl.scm
> index 5e9e6f0661..2110b80395 100644
> --- a/gnu/services/sysctl.scm
> +++ b/gnu/services/sysctl.scm
> @@ -58,9 +58,8 @@
>          (documentation "Configure kernel parameters at boot.")
>          (provision '(sysctl))
>          (start #~(lambda _
> -                   (zero? (system* #$sysctl "--load" #$sysctl.conf))))
> -        (stop #~(const #t))
> -        (respawn? #f))))))
> +                   (invoke #$sysctl "--load" #$sysctl.conf)))
> +        (one-shot? #t))))))

Perhaps we’d rather keep the (zero? (system* …)) idiom here, so that
‘herd start’ gracefully reports failure of ‘sysctl’.

Apart from that, it’s all good to me!  :-)

Ludo’.
Efraim Flashner Nov. 20, 2019, 7:24 p.m. UTC | #2
On Wed, Nov 20, 2019 at 03:10:57PM +0100, Ludovic Courtès wrote:
> Hello!
> 
> Efraim Flashner <efraim@flashner.co.il> skribis:
> 
> > From 796bf6d1b58d675b04198e536bae62552b16da75 Mon Sep 17 00:00:00 2001
> > From: Efraim Flashner <efraim@flashner.co.il>
> > Date: Sat, 16 Nov 2019 23:33:31 +0200
> > Subject: [PATCH] services: sysctl: Make service one-shot.
> >
> > * gnu/services/sysctl.scm (sysctl-shepherd-service): Adjust shepherd
> > service to use the 'one-shot?' keyword. Remove 'stop' command. Remove
> > 'respawn' option.
> > ---
> >  gnu/services/sysctl.scm | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/gnu/services/sysctl.scm b/gnu/services/sysctl.scm
> > index 5e9e6f0661..2110b80395 100644
> > --- a/gnu/services/sysctl.scm
> > +++ b/gnu/services/sysctl.scm
> > @@ -58,9 +58,8 @@
> >          (documentation "Configure kernel parameters at boot.")
> >          (provision '(sysctl))
> >          (start #~(lambda _
> > -                   (zero? (system* #$sysctl "--load" #$sysctl.conf))))
> > -        (stop #~(const #t))
> > -        (respawn? #f))))))
> > +                   (invoke #$sysctl "--load" #$sysctl.conf)))
> > +        (one-shot? #t))))))
> 
> Perhaps we’d rather keep the (zero? (system* …)) idiom here, so that
> ‘herd start’ gracefully reports failure of ‘sysctl’.

I didn't think that'd be a problem.

> 
> Apart from that, it’s all good to me!  :-)
> 
> Ludo’.

Ok, patch pushed!
diff mbox series

Patch

diff --git a/gnu/services/sysctl.scm b/gnu/services/sysctl.scm
index 5e9e6f0661..2110b80395 100644
--- a/gnu/services/sysctl.scm
+++ b/gnu/services/sysctl.scm
@@ -58,9 +58,8 @@ 
         (documentation "Configure kernel parameters at boot.")
         (provision '(sysctl))
         (start #~(lambda _
-                   (zero? (system* #$sysctl "--load" #$sysctl.conf))))
-        (stop #~(const #t))
-        (respawn? #f))))))
+                   (invoke #$sysctl "--load" #$sysctl.conf)))
+        (one-shot? #t))))))
 
 (define sysctl-service-type
   (service-type