sv(8)
π sv(8) β the manual, but make it make sense
okay so bestie, you're reading the System Manager's Manual page for sv, and honestly? it's a whole vibe. let me walk you through it π«Ά
β¨ NAME β¨
sv β control and manage services monitored by runsv(8) π
π¦ SYNOPSIS π¦
sv [-v] [-w sec] command services
/etc/init.d/service [-w sec] command
πΈ DESCRIPTION πΈ
sv is literally the girl who reports the current status and controls the state of services monitored by the runsv(8) supervisor. main character energy, no cap β¨
services is one or more arguments, and each argument names a directory service used by runsv(8). so like, one or more, bestie, you can pass a bunch π
here's the lookup rule and it's important so pay attention π β if service doesn't start with a dot or a slash and doesn't end with a slash, it gets searched in the default services directory /service/. otherwise it's resolved relative to the current directory.
command is one of up, down, status, once, pause, cont, hup, alarm, interrupt, 1, 2, term, kill, or exit, or start, stop, restart, shutdown, force-stop, force-reload, force-restart, force-shutdown. yes that's a lot, no i'm not sorry π
sv can be sym-linked to /etc/init.d/ to provide an LSB init script interface. in that case, the service to be controlled is specified by the base name of the init script. iykyk π§
π COMMANDS π
statusβ report the current status of the service to standard output, plus the appendant log service if there is one. it's giving "receipts" πupβ if the service is not running, start it. if the service stops, restart it. ride or die behavior fr fr π₯downβ if the service is running, send it theTERMsignal, and theCONTsignal. if./runexits, start./finishif it exists. after it stops, do not restart the service. it's over, she's not coming back πonceβ if the service is not running, start it. do not restart it if it stops. one shot, one opportunity π―pause,cont,hup,alarm,interrupt,quit,1,2,term,killβ if the service is running, send it theSTOP,CONT,HUP,ALRM,INT,QUIT,USR1,USR2,TERM, orKILLsignal respectively. pick your fighter πexitβ if the service is running, send it theTERMsignal, and theCONTsignal. do not restart the service. ok and then it gets a little unhinged, stay with me:- if the service is down, and no log service exists,
runsv(8)exits. - if the service is down and a log service exists,
runsv(8)closes the standard input of the log service and waits for it to terminate. - if the log service is down,
runsv(8)exits. - this command is ignored if it is given to an appendant log service. π
- if the service is down, and no log service exists,
ngl this next line is the most important line on the whole page:svactually looks only at the first character of these commands. so like,sis doing a LOT of heavy lifting here. be normal about it π
β Commands compatible to LSB init script actions
statusβ same asstatus. iconic, consistent, no notes πstartβ same asup, but wait up to 7 seconds for the command to take effect. then report the status or timeout. and listen: if the script./checkexists in the service directory,svruns this script to check whether the service is up and available; it's considered to be available if./checkexits with0. π«Άstopβ same asdown, but wait up to 7 seconds for the service to become down. then report the status or timeout.reloadβ same ashup, and additionally report the status afterwards. so extra of her β¨restartβ send the commandsterm,cont, andupto the service, and wait up to 7 seconds for the service to restart. then report the status or timeout. if the script./checkexists in the service directory,svruns this script to check whether the service is up and available again; it's considered to be available if./checkexits with0. πshutdownβ same asexit, but wait up to 7 seconds for therunsv(8)process to terminate. then report the status or timeout.force-stopβ same asdown, but wait up to 7 seconds for the service to become down. then report the status, and on timeout send the service thekillcommand. she asked nicely first πforce-reloadβ send the service thetermandcontcommands, and wait up to 7 seconds for the service to restart. then report the status, and on timeout send the service thekillcommand.force-restartβ send the service theterm,contandupcommands, and wait up to 7 seconds for the service to restart. then report the status, and on timeout send the service thekillcommand. if the script./checkexists in the service directory,svruns this script to check whether the service is up and available again; it's considered to be available if./checkexits with0. π₯force-shutdownβ same asexit, but wait up to 7 seconds for therunsv(8)process to terminate. then report the status, and on timeout send the service thekillcommand.try-restartβ if the service is running, send it thetermandcontcommands, and wait up to 7 seconds for the service to restart. then report the status or timeout. lowkey the most polite one here πΈ
π§ Additional Commands
checkβ check for the service to be in the state that's been requested (upordown). wait up to 7 seconds for the service to reach the requested state, then report the status or timeout. if the requested state of the service is up, and the script./checkexists in the service directory,svruns this script to check whether the service is up and running; it's considered to be up if./checkexits with0. vibe check, literally β
π OPTIONS π
-vβ if the command isup,down,term,once,cont, orexit, then wait up to 7 seconds for the command to take effect. then report the status or timeout. patience is a virtue bestie π°οΈ-wsecβ override the default timeout of 7 seconds withsecseconds. this option implies-v. you're in charge now π
π ENVIRONMENT π
SVDIRβ the environment variable$SVDIRoverrides the default services directory/service/. ποΈSVWAITβ the environment variable$SVWAIToverrides the default 7 seconds to wait for a command to take effect. it is overridden by the-woption. so-wbeats$SVWAIT, noted π
π EXIT CODES π
sv exits 0, if the command was successfully sent to all services, and, if it was told to wait, the command has taken effect to all services. slay π
for each service that caused an error (e.g. the directory is not controlled by a runsv(8) process, or sv timed out while waiting), sv increases the exit code by one and exits non zero. the maximum is 99. sv exits 100 on error. π
and if sv is called with a base name other than sv, the rules change, so like, heads up:
- it exits
1on timeout or trouble sending the command - if the command is
status, it exits3if the service is down, and4if the status is unknown - it exits
2on wrong usage - and
151on error π
π₯ SEE ALSO π₯
runsv(8), chpst(8), svlogd(8), runsvdir(8), runsvchdir(8), runit(8), runit-init(8)
π AUTHOR π
Gerrit Pape <pape@smarden.org>
and that's the whole page, bestie β¨π
π¦ β this little masterpiece lives in the System Manager's Manual as sv(8), and the footer's just sv(8) again because the manual already knows her name π go forth and manage those services, you absolute icon π«ΆπΈ
π¦ where this page comes from
- alpine 3.24: runit-doc 2.3.1-r0 Β· BSD
- nixpkgs unstable: runit 2.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms