[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23170: [PATCH shepherd] Restart dependent services on service restar
From: |
Ludovic Courtès |
Subject: |
bug#23170: [PATCH shepherd] Restart dependent services on service restart |
Date: |
Sat, 25 Aug 2018 16:41:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi again! :-)
Carlo Zancanaro <address@hidden> skribis:
> I've written a patch to fix this. It's not super smart, but it should
> do the job.
I wonder if there are cases where one might want to restart a service
without restarting its dependent services. We can probably ignore it
for now, but perhaps we’ll need to add a flag or a separate action later.
Thoughts?
> From 50dd3ef4888b04ea3b869da893b23ad69fad8971 Mon Sep 17 00:00:00 2001
> From: Carlo Zancanaro <address@hidden>
> Date: Sat, 25 Aug 2018 20:32:11 +1000
> Subject: [PATCH] service: Restart dependent services on service restart
>
> * modules/shepherd/service.scm (required-by?): New procedure.
> (stop): Return a list of canonical-names for stopped dependent services,
> including transitive dependencies.
> (action)[restart]: Start services based on the return value of stop.
> (fold-services): New procedure.
> * tests/restart.sh: New file.
> * Makefile.am (TESTS): Add tests/restart.sh.
[...]
> +# Restart test1 and make sure that both services are still running (ie. that
> +# test2 hasn't been stopped)
> +$herd restart test1
> +$herd status test1 | grep started
> +$herd status test2 | grep started
> +
> +# Now let's test with a transitive dependency
> +$herd start test3
> +$herd status test3 | grep started
> +
> +# After restarting test1 we want test3 to still be running
> +$herd restart test1
> +$herd status test1 | grep started
> +$herd status test2 | grep started
> +$herd status test3 | grep started
For clarity, should we do an explicit “herd stop test1” followed by
“herd start test1”? I know it’s currently equivalent under the hood,
but it might be slightly clearer. WDYT?
Otherwise it LGTM. Thanks for addressing these longstanding issues!
Ludo’.