-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes tons of issues related to startup and shutdown
- Loading branch information
1 parent
e1b5974
commit abf7b52
Showing
29 changed files
with
74 additions
and
81 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
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,8 +1,6 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
. "/usr/local/bin/logger" | ||
program_name="log-config" | ||
|
||
echo "Configuring log rotation with a maximum of ${MAX_LOG_NUMBER} logs and a max log size of ${MAX_LOG_SIZE_BYTES} bytes" | info "[${program_name}] " | ||
echo -n "1 n${MAX_LOG_NUMBER} s${MAX_LOG_SIZE_BYTES}" > /var/run/s6/container_environment/S6_LOGGING_SCRIPT | ||
sed -i "s/nMAX_NUMBER_OF_LOGS/n${MAX_LOG_NUMBER}/g" /etc/socklog.rules/zoneminder-log | ||
sed -i "s/sMAX_SIZE_OF_LOGS/s${MAX_LOG_SIZE_BYTES}/g" /etc/socklog.rules/zoneminder-log | ||
echo -n "1 n${MAX_LOG_NUMBER} s${MAX_LOG_SIZE_BYTES}" > /run/s6/container_environment/S6_LOGGING_SCRIPT |
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
. "/usr/local/bin/logger" | ||
program_name="zm-config" | ||
|
||
|
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
. "/usr/local/bin/logger" | ||
program_name="msmtp-config" | ||
|
||
|
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
. "/usr/local/bin/logger" | ||
program_name="nginx-config" | ||
|
||
|
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
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
program_name="fcgiwrap" | ||
|
||
s6-format-filter "%1 %s" "[${program_name}]" | logutil-service /log/"${program_name}" |
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
program_name="mariadb-configure" | ||
|
||
s6-format-filter "%1 %s" "[${program_name}]" | logutil-service /log/"${program_name}" |
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
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,7 +1,7 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
# ============================================================================== | ||
# Mariadb | ||
# Take down the S6 supervision tree if db is no longer accessible | ||
# ============================================================================== | ||
|
||
s6-svscanctl -t /var/run/s6/services | ||
/run/s6/basedir/bin/halt |
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
program_name="mariadb" | ||
|
||
s6-format-filter "%1 %s" "[${program_name}]" | logutil-service /log/"${program_name}" |
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
program_name="nginx" | ||
|
||
s6-format-filter "%1 %s" "[${program_name}]" | logutil-service /log/"${program_name}" |
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,13 +1,14 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
. "/usr/local/bin/logger" | ||
# ============================================================================== | ||
# Nginx | ||
# Runs Nginx | ||
# ============================================================================== | ||
|
||
echo "Waiting for ZoneMinder to start" | info | ||
/bin/s6-svwait -U /var/run/s6/services/zoneminder | ||
s6-svwait -U /run/service/zoneminder | ||
|
||
echo "Starting Nginx..." | info | ||
|
||
exec fdmove -c 2 1 nginx -g 'daemon off;' | ||
exec fdmove -c 2 1 \ | ||
/usr/sbin/nginx -g 'daemon off;' |
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
program_name="php-fpm" | ||
|
||
s6-format-filter "%1 %s" "[${program_name}]" | logutil-service /log/"${program_name}" |
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,12 @@ | ||
#!/command/with-contenv bash | ||
program_name="zoneminder" | ||
|
||
s6-tai64n | s6-tai64nlocal | s6-format-filter "%1 %s" "[${program_name}]" | \ | ||
s6-envuidgid -D 65534:65534 nobody \ | ||
s6-log -b -- \ | ||
- \ | ||
+local1.* \ | ||
n"${MAX_LOG_NUMBER}" \ | ||
s"${MAX_LOG_SIZE_BYTES}" \ | ||
1 \ | ||
/log/"${program_name}" |
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 @@ | ||
3 |
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 @@ | ||
#!/command/with-contenv bash | ||
. "/usr/local/bin/logger" | ||
# ============================================================================== | ||
# Socklog | ||
# Starts socklog to capture logs | ||
# ============================================================================== | ||
|
||
s6-socklog -d3 -t3000 |
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,24 +1,10 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
. "/usr/local/bin/logger" | ||
# ============================================================================== | ||
# ZoneMinder | ||
# Take down the S6 supervision tree if db is no longer accessible | ||
# ============================================================================== | ||
|
||
# Must run pkill to terminate container if db is down because zmpkg.pl stop | ||
# hangs in the event that the db is down when run | ||
if [ "${SHUTDOWN_REASON_DB_IS_DOWN:-0}" -eq "1" ]; then | ||
echo "Stopping ZoneMinder using pkill because db is down" | error | ||
pkill -15 -f /usr/bin/zm | ||
else | ||
echo "Stopping ZoneMinder" | info | ||
s6-setuidgid www-data /usr/bin/zmpkg.pl stop | ||
fi | ||
/run/s6/basedir/bin/halt | ||
|
||
# Socklog randomly started hanging container shutdown at "Docker Build #461" | ||
# The container will not stop until socklog is forcibly killed like this | ||
# Dirty hack to allow the container to shutdown | ||
echo "Stopping socklog" | error | ||
pkill -9 -f socklog | ||
|
||
s6-svscanctl -t /var/run/s6/services | ||
s6-setuidgid www-data /usr/bin/zmpkg.pl stop |
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,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
program_name="zoneminder-service" | ||
|
||
s6-format-filter "%1 %s" "[${program_name}]" | logutil-service /log/"${program_name}" |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.