runit – 无法打开supervise / ok:文件不存在

我想弄清楚为什么runit不会启动或给我的托pipe的应用程序的状态。 在Ubuntu 12.04上运行。

我创build了/ service,/ etc / sv / myapp(包含一个运行脚本,一个configuration文件,一个日志文件夹和一个运行脚本)。 我创build了一个从/ service /到/ etc / sv / myapp的符号链接

当我跑步

sudo sv s /service/* 

我收到以下错误信息:

 warning: /service/myapp: unable to open supervice/ok: file does not exist 

我的一些谷歌search透露,假设重新启动svscan服务可能会解决这个问题,但杀死它并运行svscanboot没有什么区别。

有什么build议么? 我在这里错过了一步吗?

问题是,至less在Ubuntu 12.04上,runit服务符号链接应放置在/ etc / service下,而不是/ service,按照Runit 上的Arch指南

在我的情况下,我停止服务后,从服务configuration删除PID

 # stops the service sv down serviceName # deletes the 'pid' and 'lock' files find -L /etc/service/serviceName -type f \( -name "pid" -o -name "lock" \) -delete # starts the service sv up serviceName # verify service status sv s serviceName 

我花了一段时间才find解决办法,所以我希望它能帮助别人。

当服务通过LVM链接到安装在不同文件系统上的目录时,Runit也会遇到问题。 例如,

 $ readlink -f /etc/service/my-service /opt/my-service $ mount ... /dev/mapper/lvm--local-opt on /opt type ext4 (...) $ sv once my-service warning: my-service: unable to open supervise/ok: file does not exist 

可能的解决scheme:

  • 从LVM卸载文件系统
    umount /opt; lvremove /dev/mapper/lvm--local-opt
  • 将runit服务移到更好的位置
    update-service --remove /opt/my-service; mv /opt/my-service /etc/sv; update-service --add /etc/sv/my-service
 sudo runsv /service/run/ & 

然后

 sudo sv start /service/run/ 

要么

 sudo sv up /service/run/