2

I've been trying to get these two to start when my docker image starts but they never seem to start.

[supervisord]
nodaemon=true

[program:rsyslog]
command=/bin/bash "service rsyslog start"

[program:haproxy]
command=/bin/bash "service haproxy start"

What command is needed to start both in the order of rsyslog first then haproxy?

3 Answers 3

1

This is not going to work because service ... start command starts the programm as daemon and sends it in the background. The supervisord can't deal with that rather it needs to start them as subprocess and run them in forground. See here:

Programs meant to be run under supervisor should not daemonize themselves. Instead, they should run in the foreground. They should not detach from the terminal from which they are started. The easiest way to tell if a program will run in the foreground is to run the command that invokes the program from a shell prompt. If it gives you control of the terminal back, but continues running, it’s daemonizing itself and that will almost certainly be the wrong way to run it under supervisor. You want to run a command that essentially requires you to press Ctrl-C to get control of the terminal back. If it gives you a shell prompt back after running it without needing to press Ctrl-C, it’s not useful under supervisor. All programs have options to be run in the foreground but there’s no “standard way” to do it; you’ll need to read the documentation for each program.

Here is a “real world” program configuration example from supervisord documentation:

Apache 2.2.6:

[program:apache2]
command=/path/to/httpd -c "ErrorLog /dev/stdout" -DFOREGROUND
redirect_stderr=true

Your programm's startup scripts can be a good place to find out how the program starts, for proper configuration.

Some examples are here

-1
[supervisord]
nodaemon=true

[program:rsyslog]
command=service rsyslog start

[program:haproxy]
command=service haproxy start

However, now I must delay starting haproxy as haproxy requires rsyslog to be started before hand. This however is another problem.

-1

You need to put something like that, just adjust parameters

[program:rsyslog]
command=/sbin/rsyslogd -n -a /var/run/systemd/journal/syslog
numprocs=1
autostart=true
autorestart=true

Regards,

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .