Re: Announcing shepherd-run
Hi! Efraim Flashner skribis: > 0.2.0 is now out! > 100% fewer GOOPS! > 'shepherd-run --version' now returns the correct string! Wo0t! Inspired by shepherd-run, I thought “hey let’s add this to Shepherd proper for 1.0, easy!”. Turns out that finding a way to pass the various options (‘-d’, ‘-E’, etc.) to the action that spawns a service was still an open issue. Solution: add these options to ‘herd’, and have it pass them as keyword arguments to the action that’s invoked. That’s allowed me to unify ‘herd schedule timer’ and the new ‘herd spawn transient’ (the name of the Awk-less GOOPS-less C-less ‘systemd-run’). Here’s the doc: --8<---cut here---start->8--- The “transient service maker” lets you run commands in the background, and it does so by wrapping those commands in transient services (*note Defining Services::). It is similar to the ‘systemd-run’ (https://www.freedesktop.org/software/systemd/man/latest/systemd-run.html) command, which you might have encountered before. A simple configuration file that uses this service looks like this: (use-modules (shepherd service transient)) (register-services (list (transient-service))) This creates a service called ‘transient’ that has a ‘spawn’ action, which you can use like this: # Run 'make' from the current directory. herd spawn transient -d "$PWD" -- make -j4 # Run 'rsync' from the home directory, inheriting # the 'SSH_AUTH_SOCK' environment variable. herd spawn transient \ --log-file=backup.log \ -E SSH_AUTH_SOCK=$SSH_AUTH_SOCK -- \ rsync -e ssh -vur . backup.example.org: Each of these ‘herd spawn transient’ commands creates a new transient service. Like any other service, they can be inspected and stopped. Running ‘herd stop transient’ stops all the currently running transients. The command runs from the directory specified by ‘default-service-directory’ or from that specified by the ‘--working-directory’ option of ‘herd’; it has with the environment variables in ‘default-environment-variables’, augmented with ‘HOME’ when running as a different user, with the addition of variables passed with ‘--environment-variable’. *Note Invoking herd::, for more info on influential command-line options. -- Procedure: transient-service [PROVISION] [#:requirement '()] Return a service with the given PROVISION and REQUIREMENT. The service has a ‘spawn’ action that lets users run commands in the background. --8<---cut here---end--->8--- It’s too big a change in between two release candidates, but it seemed better to get that right before 1.0. Lemme know what you think! Ludo’.
Re: Announcing shepherd-run
Thanks to a user bug report I discovered that the Shepherd devs (cough Ludo cough) were serious about removing the GOOPS interface and shepherd-run was outputting a deprecated service declaration which wasn't compatible with the 1.0.0rc1 tag of shepherd. 0.2.0 is now out! 100% fewer GOOPS! 'shepherd-run --version' now returns the correct string! -- Efraim Flashner אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted signature.asc Description: PGP signature
Re: Announcing shepherd-run
Runciter via "Development of GNU Guix and the GNU System distribution." skribis: > I actually think this is cool though, and the rest is mostly random > thoughts now that I think about this problem: a herd-based minimalist > alarm clock for production needs 2 features and must not include a third > feature: > > * Repeat, but this is trivial to do with a script. > > * A heuristic to output sound at all costs, while trying hard to output > through speakers and not headphones. This is harder, maybe not > absolutely required; I suppose phones get it right but I'm not > even sure. > > * A keystroke to stop the alarm from the X lock screen; surely the > significant other will close their mind to the truth that this feature > increases the attack surface and must not be included. All good points! I’d like to have this, but I think it’s beyond the scope of the ‘timer’ feature. :-) Ludo’.
Re: Announcing shepherd-run
Ludovic Courtès writes: Hello Ludo, > herd schedule timer at 07:00 -- mpg123 alarm.mp3 Sorry for hijacking the thread a little, and I haven't tried the Shepherd release candidate yet. Not that this is any of shepherd or herd's problem, but if you have included or plan to include this example in documentation, you might want to reconsider and include another simple meaningful example instead. I possibly noticed this only because I use a minimal WM: mpg123 won't start pulseaudio if pulseaudio is not already running. If there is a workaround other than starting pulseaudio prior, I don't know it. In case it doesn't ring, the evidence that herd did something at all will be buried in the logs. I actually think this is cool though, and the rest is mostly random thoughts now that I think about this problem: a herd-based minimalist alarm clock for production needs 2 features and must not include a third feature: * Repeat, but this is trivial to do with a script. * A heuristic to output sound at all costs, while trying hard to output through speakers and not headphones. This is harder, maybe not absolutely required; I suppose phones get it right but I'm not even sure. * A keystroke to stop the alarm from the X lock screen; surely the significant other will close their mind to the truth that this feature increases the attack surface and must not be included.
Re: Announcing shepherd-run
Efraim Flashner skribis: > On Mon, Nov 04, 2024 at 11:34:50PM +0100, Ludovic Courtès wrote: [...] >> Shepherd 1.0-to-be (current ‘devel’ branch) gained a generic ‘timer’ >> service that does the job the ‘at’ command would do back in the day >> (before the advent of CD-ROM and the information superhighway): >> >> herd schedule timer at 07:00 -- mpg123 alarm.mp3 >> >> We’re talking about something quite similar, just not delayed, right? > > systemd-run has a --timer flag, and I could see adding a flag for > shepherd-run after shepherd 1.0. > > To me the big thing systemd-run brought was being able to launch > programs from the shell and have it show up in `systemctl --user > services`, and I'd like to be able to get commands I run from the CLI to > show up in `herd status` the same way. Easy. :-) That’s really what ‘herd schedule timer’ does, except it’s delayed. > systemd has some more magic I wanted to steal, like being able to launch > GUI applications from systemd-run. Trickier I guess, because you need to pass DISPLAY etc. Food for thought! Ludo’.
Re: Announcing shepherd-run
On Mon, Nov 04, 2024 at 11:34:50PM +0100, Ludovic Courtès wrote: > Hello, > > Efraim Flashner skribis: > > > On Sun, Nov 03, 2024 at 04:57:09PM +0100, Denis 'GNUtoo' Carikli wrote: > >> Hi, > >> > >> On Sun, 3 Nov 2024 15:19:04 +0200 > >> Efraim Flashner wrote: > >> > >> > Announcing the initial release of shepherd-run! > >> > > >> > Do you have experience with systemd and systemd-run? Do you wish you > >> > were able to quickly and easily add a simple service to your (user or > >> > system) shepherd instance? > >> > > >> > Using the finest technologies from the 70's, written in gawk, I > >> > present shepherd-run! > > An interesting blend of technologies from the 70’s. :-) > > >> Is there any plans to integrate that with Guix and Shepherd later on? > > > > If it proves to be useful I could see re-writing it in guile so it can > > be part of shepherd directly. > > Shepherd 1.0-to-be (current ‘devel’ branch) gained a generic ‘timer’ > service that does the job the ‘at’ command would do back in the day > (before the advent of CD-ROM and the information superhighway): > > herd schedule timer at 07:00 -- mpg123 alarm.mp3 > > We’re talking about something quite similar, just not delayed, right? systemd-run has a --timer flag, and I could see adding a flag for shepherd-run after shepherd 1.0. To me the big thing systemd-run brought was being able to launch programs from the shell and have it show up in `systemctl --user services`, and I'd like to be able to get commands I run from the CLI to show up in `herd status` the same way. systemd has some more magic I wanted to steal, like being able to launch GUI applications from systemd-run. shepherd-run basically parses the flags and commands and then writes out a service to a temporary file and loads it with 'herd load root ...' -- Efraim Flashner אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted signature.asc Description: PGP signature
Re: Announcing shepherd-run
Hello, Efraim Flashner skribis: > On Sun, Nov 03, 2024 at 04:57:09PM +0100, Denis 'GNUtoo' Carikli wrote: >> Hi, >> >> On Sun, 3 Nov 2024 15:19:04 +0200 >> Efraim Flashner wrote: >> >> > Announcing the initial release of shepherd-run! >> > >> > Do you have experience with systemd and systemd-run? Do you wish you >> > were able to quickly and easily add a simple service to your (user or >> > system) shepherd instance? >> > >> > Using the finest technologies from the 70's, written in gawk, I >> > present shepherd-run! An interesting blend of technologies from the 70’s. :-) >> Is there any plans to integrate that with Guix and Shepherd later on? > > If it proves to be useful I could see re-writing it in guile so it can > be part of shepherd directly. Shepherd 1.0-to-be (current ‘devel’ branch) gained a generic ‘timer’ service that does the job the ‘at’ command would do back in the day (before the advent of CD-ROM and the information superhighway): herd schedule timer at 07:00 -- mpg123 alarm.mp3 We’re talking about something quite similar, just not delayed, right? Ludo’.
Re: Announcing shepherd-run
On Sun, Nov 03, 2024 at 04:57:09PM +0100, Denis 'GNUtoo' Carikli wrote: > Hi, > > On Sun, 3 Nov 2024 15:19:04 +0200 > Efraim Flashner wrote: > > > Announcing the initial release of shepherd-run! > > > > Do you have experience with systemd and systemd-run? Do you wish you > > were able to quickly and easily add a simple service to your (user or > > system) shepherd instance? > > > > Using the finest technologies from the 70's, written in gawk, I > > present shepherd-run! > Is there any plans to integrate that with Guix and Shepherd later on? If it proves to be useful I could see re-writing it in guile so it can be part of shepherd directly. > I'm thinking of uses cases like netctl which is an utility from Arch > Linux that is present in Parabola. Users define network profiles and > netctl somehow interact with systemd to setup the network. > > Here for instance Guix system services or Guix home services are not > dynamic, and especially for the network it could make sense to have > different profiles. > > As I understand netctl generates systemd unit files, so there is > also some similarities between netctl and shepherd-run. > > Denis. Looking at some of the manpages for systemd I saw they have options for on-joining or leaving certain networks and other triggers. I don't believe shepherd currently has the ability to detect that directly currently, but I suppose it would be possible to imitate that functionality. -- Efraim Flashner אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted signature.asc Description: PGP signature
Re: Announcing shepherd-run
Hi, On Sun, 3 Nov 2024 15:19:04 +0200 Efraim Flashner wrote: > Announcing the initial release of shepherd-run! > > Do you have experience with systemd and systemd-run? Do you wish you > were able to quickly and easily add a simple service to your (user or > system) shepherd instance? > > Using the finest technologies from the 70's, written in gawk, I > present shepherd-run! Is there any plans to integrate that with Guix and Shepherd later on? I'm thinking of uses cases like netctl which is an utility from Arch Linux that is present in Parabola. Users define network profiles and netctl somehow interact with systemd to setup the network. Here for instance Guix system services or Guix home services are not dynamic, and especially for the network it could make sense to have different profiles. As I understand netctl generates systemd unit files, so there is also some similarities between netctl and shepherd-run. Denis. pgpDdFXboWuHc.pgp Description: OpenPGP digital signature