Linux command
sv 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Check status
sv status [servicename]
Start a service
sv up [servicename]
Stop a service
sv down [servicename]
Restart a service
sv restart [servicename]
Send HUP signal
sv hup [servicename]
Start service once
sv once [servicename]
Force stop
sv force-stop [servicename]
Check status
sv -v status [servicename]
说明
sv controls and manages services supervised by runsv in the runit init system. It sends commands to service directories and reports their status. Services are typically located in /service/ or a custom service directory. Each service is a directory containing a run script that runsv executes and supervises. When a service stops unexpectedly, runsv automatically restarts it. The down command prevents automatic restart, while once runs the service without restart supervision. The sv command can be symlinked to /etc/init.d/ to provide LSB init script compatibility. When invoked this way, the service name is derived from the script's basename. Status output shows the service state (run, down, finish), PID, and uptime. The log service status is also shown if a log/ subdirectory exists.
参数
- -v
- Wait up to 7 seconds for commands to take effect and report status
- -w _sec_
- Set timeout to sec seconds (implies -v)
FAQ
What is the sv command used for?
sv controls and manages services supervised by runsv in the runit init system. It sends commands to service directories and reports their status. Services are typically located in /service/ or a custom service directory. Each service is a directory containing a run script that runsv executes and supervises. When a service stops unexpectedly, runsv automatically restarts it. The down command prevents automatic restart, while once runs the service without restart supervision. The sv command can be symlinked to /etc/init.d/ to provide LSB init script compatibility. When invoked this way, the service name is derived from the script's basename. Status output shows the service state (run, down, finish), PID, and uptime. The log service status is also shown if a log/ subdirectory exists.
How do I run a basic sv example?
Run `sv status [servicename]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -v do in sv?
Wait up to 7 seconds for commands to take effect and report status