Trying to log with runit only returns 'unable to open supervise/ok'
Installed runit
in Debian 7.4 in a Vagrant.
My run script is working, but the moment I create a service/pants/log/ directory I start getting the following error: unable to open supervise/ok
. My service continues to run but nothing gets logged.
I've tried two different services and both have the same issue.
I've tried various different service/pants/log/run scripts (mostly using svlogd), I've tried changing permissions on everything (a+rwx), the directory to store logs in exists and has the same permissions.
If I run svlogd straight off the commandline it works as expected.
The bash log below shows what happens as I rename /etc/service/pants/_log
to /etc/service/pants/log
and back again /etc/service/pants/_log
.
root@vwb-debian-wheezy:/etc/service# sv s pants/
run: pants/: (pid 29260) 44931s
root@vwb-debian-wheezy:/etc/service# mv pants/{_,}log/
root@vwb-debian-wheezy:/etc/service# sv s pants/
run: pants/: (pid 29260) 44963swarning: pants/: unable to open supervise/ok: file does not exist
; run: log: (pid 29260) 44963s
root@vwb-debian-wheezy:/etc/service# cat pants/log/run
#!/bin/sh
exec svlogd -ttt /var/log/service/pants/
root@vwb-debian-wheezy:/etc/service# ll pants/
total 12
drwxrwxrwx 2 root root 4096 Jul 3 07:00 log
-rwxrwxrwx 1 root root 442 Jul 3 06:58 run
drwxrwxrwx 2 root root 4096 Jul 2 18:59 supervise
root@vwb-debian-wheezy:/etc/service# ll /var/log/service/
total 8
drwxrwxrwx 2 root root 4096 Jul 2 16:55 pants
root@vwb-debian-wheezy:/etc/service# mv pants/{,_}log/
root@vwb-debian-wheezy:/etc/service# sv s pants/
run: pants/: (pid 29260) 45105s
Create the run
files in /etc/sv/pants/
not /etc/service/pants/
.
Then a symlink should be created in /etc/service
to /etc/sv/pants
to activate the service.
ln -s /etc/sv/pants /etc/service/
While creating the files directly in /etc/service
works for just the service, it seems to cause problems when using logging as well.
A service can be deactivated by deleting the symlink in /etc/service/
.
For the Debian installation, there are two directories: /etc/service
and /service
. For your service to be effectively controlled, they should be more-or-less mirror images of each other. In your example, for service pants
, there should be a symlink /etc/service/pants
and a symlink /service/pants
, each should point to /etc/sv/pants
. You can "cheat" and make /service
a symlink itself to /etc/service
to get the same effect, but I'm not sure as of yet the full impact of that change.