Hi Daniel,
Daniel Littlewood <[email protected]> skribis:
> I recently started using the shepherd to automate services on my guix
> system laptop. I wanted to send a message, mostly to express what a
> pleasant experience it was! I wrote it up on my blog, with some
> context.[1]
Thanks for the kind words! :-)
> 1. At some point I accidentally ran multiple copies of shepherd
> simultaneously. This seems like it’s just an error, since it caused
> all herd commands to just hang, but I didn’t get warned about it at
> all. I had to kill the shepherd process manually by doing `ps -aux |
> grep shepherd` and doing `kill PID`.
Yes, that’s not good. In the event its socket already exists, it could
try to connect to it and error out if somebody’s listening. I’ll see
what can be done.
> 2. I couldn’t figure out how to reload my init.d script without
> doing the tedious kill shepherd snippet. Also this would have killed
> my tunnel to the server if I didn’t have a separate direct-IP tunnel
> open. I wonder if it's possible to validate a service definition
> before running it.
You can reload your config file with:
herd load root ~/.config/shepherd/init.d/tuns.sh.scm
This will register a “replacement” for your ‘ssh’ service. To switch to
that replacement, you’ll need to do:
herd restart ssh
> 3. Sometimes the error messages I got from shepherd were not super
> helpful. For example at one point I gave the service a name which was
> a string rather than a symbol, and the error said `Throw to
> key%exception’ with args ("#<&message message: \"invalid service
> provision list\">")'.`. I didn’t actually know what a provision list
> was until I read the manual – it would have been nice to see something
> like expected symbol but got string "ssh" or something like this.
On the ‘main’ branch, I get something slightly better:
--8<---------------cut here---------------start------------->8---
$ ./shepherd -c tt.scm -I -s sock
GNU Shepherd 1.0.3 (Guile 3.0.9, x86_64-unknown-linux-gnu)
Starting service root...
Service root started.
Service root running with value #<<process> id: 4599 command: #f>.
Service root has been started.
Error while loading configuration file 'tt.scm': invalid service provision list
shepherd: error: "tt.scm": exception thrown while loading configuration file
C-c C-cStopping service root...
Exiting shepherd...
Exiting.
ludo@ribbon ~/src/shepherd [env]$ cat tt.scm
(define foo
(service 'whatever
#:requirement '(x)
#:start (const #t)))
(register-services (list foo))
--8<---------------cut here---------------end--------------->8---
But yes, we can improve on that message.
Thanks for your feedback!
Ludo’.