| Systemd ideas I'm all for but it only hints at linux lack of clean abstraction power. sysvinit was full of redundancy; apparently BSD found a way to make a thin abstraction layer to make init files clean. Bash isn't "good" at hinting proper abstractions, I rarely see talks about this, maybe gurus can see through the rain. I keep seeing a place for a tiny lambda friendly intermediate layer .. Just so you can compose properties of your services like clojure ring middleware. (->
(path "/usr/bin/some-service" "arg0" ...)
(wrap :pre (lambda () ...)
:post (lambda () ..))
(retry 5)
...
(timeout 5))
Is this ugly to your eyes ?ps: the idea is that (retry 5) is a normal language function, and not a systemd opaque built-in, you can write your own thing, and the most used can go upstream. Hoping to avoid the sysvinit fragility and redundancy. |
https://cr.yp.to/daemontools.html
http://smarden.org/runit/
Here is a bash function that retries N times:
Then you can compose with a timeout function, which already exists: You can pass the names of other functions as pre and post hooks as well.https://www.gnu.org/software/coreutils/manual/html_node/time...
Shell has a very forth-like quality to it, and Forth is sort of like a backwards Lisp as well (postfix rather than prefix).