命令“sudo service supervisord start”和“sudo supervisord”有什么区别?

2024-04-26 23:00:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试编写一个配置文件来运行supervisord和daemonize一些任务。现在我有一个虚拟程序,它向cli回显“hello”,这样我就知道supervisord使用我的conf文件了。有两个命令我试图启动supervisord,一个使用我的配置文件,另一个无法使用我的配置文件,我不知道为什么。在

失败的命令:

sudo service supervisord start --configuration=/current/director/path/supervisord.conf --nodaemon=true

结果:

^{pr2}$

有效的命令:

 sudo supervisord --configuration=/current/directory/path/supervisord.conf

结果:

 2014-11-10 22:46:07,332 DEBG fd 6 closed, stopped monitoring <POutputDispatcher at 140621301889000 for <Subprocess at 140621301888424 with name flower in state STARTING> (stdout)>
 2014-11-10 22:46:07,333 DEBG fd 8 closed, stopped monitoring <POutputDispatcher at 140621301954896 for <Subprocess at 140621301888424 with name flower in state STARTING> (stderr)>
 2014-11-10 22:46:07,334 INFO exited: flower (exit status 1; not expected)
 2014-11-10 22:46:07,335 DEBG received SIGCLD indicating a child quit
 2014-11-10 22:46:08,336 INFO gave up: flower entered FATAL state, too many start retries too quickly
 2014-11-10 22:46:28,858 WARN received SIGHUP indicating restart request
 2014-11-10 22:47:03,170 CRIT Supervisor running as root (no user in config file)
 2014-11-10 22:47:03,175 INFO supervisord started with pid 28776
 2014-11-10 22:47:04,178 INFO spawned: 'flower' with pid 28779
 2014-11-10 22:47:04,185 DEBG 'flower' stdout output:
 hello

第二个结果死掉的事实很好,因为我希望它在回响“hello”之后会死,至少我知道它在使用指定路径中的conf文件。我很困惑为什么第一个命令不使用我的配置文件,这两者之间有什么区别?在

在监督人.conf公司名称:

[supervisord]
logfile=/logfile/user/has/access/to/supervisord.log
loglevel=debug

[program:flower]
command=echo hello
process_name=%(program_name)s
autostart=True
autorestart=True

Tags: 文件namein命令infohelloconf配置文件
1条回答
网友
1楼 · 发布于 2024-04-26 23:00:52

短版: 它完全忽略了您提供的参数。在

较长版本: 您所指示的第一个命令sudo service supervisord start configuration=/current/director/path/supervisord.conf nodaemon=true,并不是为获取所提供的方法中的参数而设计的。相反,service取服务的名称(通常在/etc/init.d/中找到)和一个操作。还可以传递其他参数,这些参数可能因操作系统而异。有关操作系统的详细信息,请参阅手册页(man service)。在

要执行的操作通常是以下操作之一:

  • 开始
  • 住手
  • 重新启动
  • 重新加载
  • 状态

使用service命令的正确方法是sudo service supervisord start。这将使用一个配置文件,该文件位于/etc/default/etc/sysconfig/etc的子目录或{}的根目录中。位置将有所不同,并取决于您使用的特定linux发行版。在

要了解导致supervisord运行和退出的实际情况的详细信息,请签入/var/log,特别是查看文件/var/log/messages(如果存在),或者{},或者查找名为supervisord的文件或子目录。在

相关问题 更多 >