In my previous post, Using Void Linux As My Daily Driver, I wrote that I used vpm as a wrapper for the xbps-* commands to manage packages on Void Linux. I like how convenient the tool is and how it works (it knows it’s a wrapper command and it doesn’t try to hide that fact). It also makes the output very colorful, which I do like a lot. I know that’s a bit of a simple reason, but I personally just like very colorful output (with the option to disable it of course).

Managing services on Void Linux is already fairly easy using the sv command; however, I felt a couple of things could be made simpler and that the output could be more obvious at a quick glance.

With that, vsv was born.

vsv is a bash script wrapper for the sv command that can be used to query and manage services via runit. It was made specifically for Void Linux but should theoretically work on any system using runit to manage services.

vsv was inspired by vpm . vsv is to sv what vpm is to the xbps-* commands. vsv is available under the MIT License on GitHub:

https://github.com/bahamas10/vsv

vsv can be called without any arguments to get process status (as seen in the screenshot above). This is equivalent to running vsv status .

Note: sudo or escalated privileges are required to determine service state because of the strict permissions on each service’s supervise directory.

vsv scans the /var/service directory by default, which can be overridden by setting the $SVDIR environmental variable or passing in a -d <dir> argument. Any service that has been in a state for less than 5 seconds will be marked in red, making new or failing services easy to spot:

Services in a state for more than 5 seconds but less than 30 seconds will be marked in yellow:

A string can be passed as the first argument after status to filter for services that contain that string in their name. Also, -t can be supplied to status to print the process tree of the pid for that process:

Any command other than status will be passed directly to the sv command. Restarting a service is as easy as vsv restart <svc> :

To stop a service, vsv down <svc> can be used:

A full service tree can be generated with vsv -t . This command is equivalent to running vsv status -t :

vsv also first-classes the notion of “user services”. I wrote about this in my blog post for Using Linux As My Daily Driver. Basically, I have a separate instance of runsvdir running as my user out of ~/runit/sv , and the vsv script is set up to look in that location when invoked with -u .

Note that -u is just a shortcut for -d ~/runit/sv - technically, any directory can be specified with that option:

All of the commands and options are supported when -u or -d <dir> is specified.

Installation

On Void Linux run:

xbps-install vsv

vsv is a standalone bash script that can be dumped anywhere in your $PATH to be used.

I personally install it with git (with ~/bin in my $PATH ):

mkdir -p ~/bin ~/dev cd ~/dev git clone git://github.com/bahamas10/vsv.git ln -s ~/dev/vsv/vsv ~/bin

Otherwise, you can use curl or wget to pull the script directly from GitHub:

mkdir -p ~/bin cd ~/bin wget https://raw.githubusercontent.com/bahamas10/vsv/master/vsv # or curl -O https://raw.githubusercontent.com/bahamas10/vsv/master/vsv

And then:

chmod +x ~/bin/vsv

Usage

Quick Examples:

vsv - show all services

- show all services vsv status - same as above

- same as above vsv stop <svc> - stop a service

- stop a service vsv start <svc> - start a service

- start a service vsv restart <svc> - restart a service

- restart a service vsv hup <svc> - refresh a service ( SIGHUP )

Command Usage: