From the docs
For each control character c sent to the control pipe, runsv first
checks if service/control/c exists and is executable. If so, it starts
service/control/c and waits for it to terminate, before interpreting
the command. If the program exits with return code 0, runsv refrains
from sending the service the corresponding signal. The command o is
always considered as command u. On command d first service/control/t
is checked, and then service/control/d. On command x first
service/control/t is checked, and then service/control/x. The control
of the optional log service cannot be customized.
That means you need to create a
service_name/control/X, X being an executable that will run when you send the related
sv command to the service, like the
d command (down). If your script exits with status 0 it will not try to down the service itself.
Basically you need an executable script on
/etc/sv/<service>/control/d that will do whatever you want and kill the service, clean up pids and etc.