大网数据广告活动
服务器运维问答

Trying to log with runit only returns 'unable to open supervise/ok'

· 52CE 我爱测

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 nothi…

问题原文

原帖链接 · Rudolf Vavruch · CC BY-SA 3.0

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

已采纳解答

原帖链接 · Rudolf Vavruch · CC BY-SA 3.0

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/.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。