RUNIT - created first service directory, "sv start testrun" does not work

Your service isn't set up correctly. The reason it worked is that you invoked it directly from the service definition and not from the actual service control.

When runit's service management starts, it expects a /service directory to exist, although some installs (like Debian Jessie) currently have it at /etc/service for reasons unknown. The error message comes from this missing directory, which it is trying to change to, hence the unable to change service directory message. Do the following as root:

mkdir -p /etc/service
cd /
ln -s /etc/service
cd /service
ln -s /etc/sv/testrun

This will:

  • create the service directory if it doesn't exist
  • place a symlink in the root so that runsvdir will be able to change to /service as its working directory
  • creates a link to your testrun service, assuming you have it defined at /etc/sv/testrun

runsvdir will then be able to change its directory into /service, find your symlink for testrun, and then launch it. You can verify this by using ps fax or pstree -A to see the process tree; there should be a runsv with your command attached to it. Note: sometimes it may take a second or two for the runsvdir process to get its head oriented, so if you look right away and don't see it in the process tree, wait 2-3 seconds and try again, and it should show up. This appears to only happen when it starts up.

Tags:

Runit