-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from bebehei/signal-handling
use correct signal-handler for supervisord
- Loading branch information
Showing
10 changed files
with
57 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[program:apache2] | ||
command=/opt/supervisor/apache2_supervisor | ||
autorestart=true | ||
startretries=3 | ||
# redirect output to stdout/stderr and do not use a regular logfile | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[eventlistener:fatalservice] | ||
command=/opt/supervisor/fatalservicelistener | ||
events=PROCESS_STATE_FATAL | ||
# redirect output to stdout/stderr and do not use a regular logfile | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,9 @@ | ||
[unix_http_server] | ||
file=/var/run/supervisor.sock | ||
chmod=0700 | ||
|
||
[supervisord] | ||
nodaemon=true | ||
logfile=/tmp/supervisord.log | ||
logfile_maxbytes=50MB | ||
pidfile=/tmp/supervisord.pid | ||
|
||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor.sock | ||
|
||
[program:apache2] | ||
command=/bin/bash -c "/opt/supervisor/apache2_supervisor" | ||
redirect_stderr=true | ||
|
||
[program:mysql] | ||
command=/bin/bash -c "/opt/supervisor/mysql_supervisor" | ||
redirect_stderr=true | ||
|
||
[program:icinga2] | ||
command=/bin/bash -c "/opt/supervisor/icinga2_supervisor" | ||
redirect_stderr=true | ||
command=/opt/supervisor/icinga2_supervisor | ||
autorestart=true | ||
startretries=3 | ||
# redirect output to stdout/stderr and do not use a regular logfile | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[program:mysql] | ||
command=/opt/supervisor/mysql_supervisor | ||
autorestart=true | ||
startretries=3 | ||
# redirect output to stdout/stderr and do not use a regular logfile | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
#!/bin/bash | ||
|
||
function shutdown() | ||
{ | ||
echo "`date +"%d.%m.%Y %T.%3N"` - Shutting down apache2" | ||
/etc/init.d/apache2 stop | ||
} | ||
|
||
|
||
echo "`date +"%d.%m.%Y %T.%3N"` - Starting apache2" | ||
|
||
/etc/init.d/apache2 start | ||
service apache2 start | ||
|
||
# Allow any signal which would kill a process to stop server | ||
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP | ||
trap "service apache2 stop" HUP INT QUIT ABRT KILL ALRM TERM TSTP | ||
|
||
while pgrep -u www-data apache2 > /dev/null; do sleep 5; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# eventlistener to shutdown on first service event | ||
# configured on events PROCESS_STATE_FATAL, it shuts down | ||
# on first failing service. Useful for docker-containers | ||
|
||
# Report readiness to supervisord | ||
echo READY | ||
|
||
# Wait for first input (first fatal event) | ||
read line | ||
|
||
# and finally shutdown | ||
supervisorctl shutdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
#!/bin/bash | ||
|
||
function shutdown() | ||
{ | ||
echo "`date +"%d.%m.%Y %T.%3N"` - Shutting down mysql" | ||
/etc/init.d/mysql stop | ||
} | ||
|
||
echo "`date +"%d.%m.%Y %T.%3N"` - Starting mysql" | ||
|
||
/etc/init.d/mysql start | ||
service mysql start | ||
|
||
# Allow any signal which would kill a process to stop server | ||
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP | ||
trap "service mysql stop" HUP INT QUIT ABRT KILL ALRM TERM TSTP | ||
|
||
while pgrep -u mysql mysql > /dev/null; do sleep 5; done |