前:
root@haproxy:/# ps aux | grep rsyslog
root 420 0.0 0.1 8860 648 ? S+ 12:38 0:00 grep --color=auto rsyslog
启动Supervisord并报错:
root@haproxy:/# /usr/bin/supervisord
/usr/lib/python2.7/dist-packages/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2015-11-25 12:06:59,742 CRIT Supervisor running as root (no user in config file)
2015-11-25 12:06:59,743 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2015-11-25 12:06:59,769 INFO RPC interface 'supervisor' initialized
2015-11-25 12:06:59,770 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2015-11-25 12:06:59,770 INFO supervisord started with pid 211
2015-11-25 12:07:00,774 INFO spawned: 'rsyslog' with pid 214
2015-11-25 12:07:00,845 INFO exited: rsyslog (exit status 0; not expected)
2015-11-25 12:07:01,849 INFO spawned: 'rsyslog' with pid 232
2015-11-25 12:07:01,874 INFO exited: rsyslog (exit status 0; not expected)
2015-11-25 12:07:03,879 INFO spawned: 'rsyslog' with pid 243
2015-11-25 12:07:03,902 INFO exited: rsyslog (exit status 0; not expected)
2015-11-25 12:07:06,907 INFO spawned: 'rsyslog' with pid 254
2015-11-25 12:07:06,926 INFO exited: rsyslog (exit status 0; not expected)
2015-11-25 12:07:07,928 INFO gave up: rsyslog entered FATAL state, too many start retries too quickly
后:
root@haproxy:/# ps aux | grep rsyslog
syslog 435 0.1 0.2 116572 1208 ? Ssl 12:39 0:00 /usr/sbin/rsyslogd
root 474 0.0 0.1 8860 648 ? S+ 12:39 0:00 grep --color=auto rsyslog
文件/etc/supervisor/conf.d/supervisord.conf
:
[supervisord]
nodaemon=true
[program:rsyslog]
command=service rsyslog start
startsecs=5
我可以手动启动rsyslog
而不会出现任何问题:
service rsyslog start
因此,正如您所看到的,在我继续启动supervisord之前,rsyslog没有运行。在我运行supervisord之后,它确实启动了rsyslog,但是会生成并退出。有人知道这背后的原因吗?
答案1
找到了这颗有用的小钻石:
[program:rsyslog]
command=rsyslogd -n -c5
autostart=true
autorestart=true
redirect_stderr=true