SupervisorD

Gewijzigd op Di, 20 Jan om 1:24 PM

SupervisorD

Supervisor daemon is a client/server system that monitors and controls processes on UNIX-like operating systems. The Supervisor check monitors uptime, status, and number of running processes.


How to use SupervisorD

You configure your applications in its configuration file with their start commands and desired behaviour, then control or check the status of all programs using supervisorctl command-line tool.


Configuration file.

You can place your configuration files in ~/.config/supervisor/conf.d/.
Supervisord will pick up any file ending with .conf


There are 2 template files you can use, for magento 2 and shopware. Just rename them to .conf After that you can start the commands through supervisor.


Config files examples:

[program:my_app]
#The full command to execute
command=~/bin/php /path/to/your/app.php --config /path/to/config.ini
#Start the program when supervisord starts
autostart=true
#Restart the program if it exits unexpectedly
autorestart=true
#Log file for stdout
stdout_logfile=~/log/supervisor/my_app.log
#Log file for stderr
stderr_logfile=~/log/supervisor/my_app_error.log

You can define multiple programs in the same configuration file.

[program:my_app]
command=~/bin/php /path/to/your/app.php --config /path/to/config.ini

[program:my_other_app]
command=~/bin/php /path/to/your/my_other_app.php --config /path/to/config.ini


Loading the config files

To load the configs you need to add our default config  -c ~/.config/supervisor/supervisord.conf to every command. 

supervisorctl -c ~/.config/supervisor/supervisord.conf status.


You can add the following code to you .bashrc file to alias the supervisorctl command to include the config by default.

# Default supervisorctl config if used
if [ -x /usr/bin/supervisorctl ] && [ -f ~/.config/supervisor/supervisord.conf ]; then
    alias supervisorctl='/usr/bin/supervisorctl -c ~/.config/supervisor/supervisord.conf'
fi


SupervisorD commands

CommandDescription
supervisorctl statusShows the current state (e.g., RUNNING, STOPPED, FATAL) of all managed programs.
supervisorctl start [program_name]Starts a specific program defined in the configuration.
supervisorctl stop [program_name]Gracefully stops a running program.
supervisorctl restart [program_name]Stops and then restarts a specific program.
supervisorctl rereadInstructs the daemon to read the configuration files for any changes.
supervisorctl updateApplies changes detected by reread (e.g., starts new programs or stops deleted ones). Always run after reread.
supervisorctl shutdownShuts down the Supervisord daemon entirely.
supervisorctl tail -f [program_name]Shows the last part of a program's output log and follows it (similar to tail -f).

Was dit artikel nuttig?

Dat is fantastisch!

Hartelijk dank voor uw beoordeling

Sorry dat we u niet konden helpen

Hartelijk dank voor uw beoordeling

Laat ons weten hoe we dit artikel kunnen verbeteren!

Selecteer tenminste een van de redenen
CAPTCHA-verificatie is vereist.

Feedback verzonden

We stellen uw moeite op prijs en zullen proberen het artikel te verbeteren