runsvdir(8)
π runsvdir β from the System Manager's Manual bestie collection π
okay so. imagine you have a whole folder of little service thingies and you need someone to babysit every single one of them, forever, and restart them the literal second they fall over. that someone? that's runsvdir. she's the group chat admin of your entire service directory and she never sleeps. π«Ά
β¨ NAME β¨
runsvdir β starts and monitors a collection of runsv(8) processes π
πΈ SYNOPSIS πΈ
runsvdir [-P] dir [ log ]
π¦ DESCRIPTION π¦
so first things first: dir has to be a directory. like, non-negotiable, it's a directory. and log is a space holder for a readproctitle log, and it has to be at least seven characters long or justβ¦ not there at all. seven. count them. no cap. π’
runsvdir starts a runsv(8) process for every subdirectory β or symlink to a directory β inside the services directory dir, up to a limit of 1000 subdirectories. and if any of those runsv(8) processes terminates? she just starts it right back up. main character behavior honestly. β¨
she also skips subdirectory names that start with dots. invisible to her. ghosted. π
heads up bestie:runsv(8)must be inrunsvdir'sPATH. if it's not, this whole thing is not gonna go how you want it to. π
At least every five seconds, runsvdir checks whether the time of last modification, the inode, or the device, of the services directory dir has changed. if it has, she re-scans the service directory. and then:
- if she sees a new subdirectory, or a new symlink to a directory, in dir, she starts a new
runsv(8)process π₯ - if she sees a subdirectory being removed that was previously there, she sends the corresponding
runsv(8)process aTERMsignal, stops monitoring that process, and therefore does not restart therunsv(8)process if it exits π
Now. If the log argument is given to runsvdir, all output to standard error gets redirected to this log, which is similar to the daemontools' readproctitle log. to see the most recent error messages, use a process-listing tool such as ps(1). and here's the cute part β runsvdir writes a dot to the readproctitle log every 15 minutes so that old error messages expire. a little period every quarter hour. she's cleaning up after herself. obsessed. π
π OPTIONS π
-Pβ usesetsid(2)to run eachrunsv(8)process in a new session and separate process group. give them their own little rooms. their own vibe. π
π SIGNALS π
- If
runsvdirreceives aTERMsignal, it exits with 0 immediately. she's out. gone. no drama. π¨ - If
runsvdirreceives aHUPsignal, it sends aTERMsignal to eachrunsv(8)process it is monitoring and then exits with 111. group hug, everyone gets aTERM, then she leaves. π
π SEE ALSO π
sv(8), runsv(8), runsvchdir(8), runit(8), runit-init(8), chpst(8), svlogd(8), utmpset(8), setsid(2)
https://smarden.org/runit/ π
π AUTHOR π
Gerrit Pape <pape@smarden.org> β thank you for the lore, king π«Ά
and that's the whole page bestie!! this one lives in the System Manager's Manual, section runsvdir(8), and it's part of the runit universe over at https://smarden.org/runit/ β there's no date stamped on this version so like, consider it eternally fresh β¨ go restart something. slay. ππ§
π¦ where this page comes from
- alpine 3.24: runit-doc 2.3.1-r0 Β· BSD
- nixpkgs unstable: runit 2.3.1
- ubuntu resolute: runit 2.3.0-1ubuntu1 Β· BSD-3-Clause
- ubuntu stonking: runit 2.3.1-5ubuntu1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms