【supervisor】unix:///tmp/supervisor.sock no such file

问题

supervisor在正常安装完时运行正常,但隔一段时间后出现了故障,重启后报:

unix:///tmp/supervisor.sock no such file

原因是 supervisor 默认配置会把 socket 文件和 pid 守护进程生成在Linux的/tmp/目录下,/tmp/目录是缓存临时文件的目录,Linux会根据不同情况自动删除其下面的文件。比如缓存超时等,因此我们需要做如下修改:

具体操作如下:

复制代码
vi /etc/supervisord.conf  

或者

复制代码
 /etc/supervisor/supervisord.conf 

unix_http_server

复制代码
;file=/tmp/supervisor.sock   ; (the path to the socket file)
file=/var/run/supervisor.sock   ; 修改为 /var/run 目录,避免被系统删除

supervisord

复制代码
;logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile=/var/log/supervisor/supervisord.log ; 修改为 /var/log 目录,避免被系统删除
pidfile=/var/run/supervisord.pid ; 修改为 /var/run 目录,避免被系统删除

supervisorctl

复制代码
; 必须和'unix_http_server'里面的设定匹配
;serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
serverurl=unix:///var/run/supervisor.sock ; 修改为 /var/run 目录,避免被系统删除

更新配置文件

supervisorctl update

但是提示

复制代码
Redirecting to /bin/systemctl start supervisor.service
Failed to start supervisor.service: Unit supervisor.service not found.

再执行 supervisorctl 时提示:

复制代码
[root@xxx run]# supervisorctl
unix:///var/run/supervisor.sock refused connection
supervisor> exit

最后

复制代码
supervisord -c /etc/supervisord.conf  # 可以直接执行这条命令, 自动创建supervisor.sock

但我的supervisord.conf 文件在 /etc/supervisor/supervisord.conf

因此执行后启动成功

复制代码
supervisord -c  /etc/supervisor/supervisord.conf 
相关推荐
Xの哲學20 小时前
Linux多级时间轮:高精度定时器的艺术与科学
linux·服务器·网络·算法·边缘计算
FlourishingMind20 小时前
蓝牙授时CTS (Current Time Service)、PTP、NTP
运维·服务器·网络
QT 小鲜肉21 小时前
【Linux命令大全】001.文件管理之mmove命令(实操篇)
linux·服务器·前端·chrome·笔记
MaximusCoder21 小时前
Linux信息收集Command
运维·服务器·经验分享
QT 小鲜肉1 天前
【Linux命令大全】001.文件管理之mdel命令(实操篇)
linux·运维·服务器·chrome·笔记
就不掉头发1 天前
I/O复用
运维·服务器·c语言·开发语言
2401_832298101 天前
云服务器:边缘计算时代的“智能节点”
运维·服务器·边缘计算
开压路机1 天前
Linux的基本指令
linux·服务器
lifewange1 天前
linux管理服务的命令有哪些
linux·运维·服务器
麒qiqi1 天前
进程间通信(IPC):管道通信全解析
linux·运维·服务器