【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 
相关推荐
松涛和鸣10 分钟前
69、Linux字符设备驱动实战
linux·服务器·网络·arm开发·数据库·驱动开发
女王大人万岁13 分钟前
Go语言JSON标准库(encoding/json):功能解析与实战指南
服务器·开发语言·后端·golang·json
“αβ”23 分钟前
IP协议内容补充
服务器·网络·网络协议·tcp/ip·智能路由器·nat·ip协议
深圳市恒讯科技28 分钟前
2026新加坡服务器硬件防火墙配置推荐
运维·服务器·云计算
小江||小廖28 分钟前
服务器如何设置共享文件夹,让其他内网电脑可以访问
运维·服务器
小虾米vivian30 分钟前
达梦使用dmfldr和外部表导入txt数据(windows环境)
java·服务器·数据库
历程里程碑33 分钟前
Linux19 实现shell基本功能
linux·运维·服务器·算法·elasticsearch·搜索引擎·哈希算法
霍格沃兹测试学院-小舟畅学36 分钟前
Playwright测试超时管理:全局与局部超时设置
运维·服务器·网络
码刘的极客手记44 分钟前
vSphere 4.1 三大实用实战:vCenter 告警自动化、SIOC 无 License 启用及 Dropbox 存储运行 VM
运维·服务器·网络·自动化·虚拟机
我也不曾来过11 小时前
进程控制(很详细)
linux·运维·服务器