From abf7b5200fc20006b7d3925186701f1deb8c2b31 Mon Sep 17 00:00:00 2001 From: Alex <33379584+alexyao2015@users.noreply.github.com> Date: Wed, 23 Feb 2022 21:10:02 -0600 Subject: [PATCH] Upgrade s6-overlay to v3 Fixes tons of issues related to startup and shutdown --- Dockerfile | 20 ++++++++----------- rootfs/etc/cont-init.d/00-reconfigure-user.sh | 2 +- rootfs/etc/cont-init.d/10-log-config.sh | 6 ++---- rootfs/etc/cont-init.d/20-system-config.sh | 4 ++-- rootfs/etc/cont-init.d/30-zm-config.sh | 2 +- rootfs/etc/cont-init.d/40-msmtp-config.sh | 2 +- rootfs/etc/cont-init.d/50-nginx-config.sh | 2 +- .../10-zoneminder-config.sh | 9 +++++---- rootfs/etc/services.d/fcgiwrap/finish | 2 +- rootfs/etc/services.d/fcgiwrap/log/run | 2 +- rootfs/etc/services.d/fcgiwrap/run | 4 ++-- .../etc/services.d/mariadb-configure/log/run | 2 +- rootfs/etc/services.d/mariadb-configure/run | 6 +++--- rootfs/etc/services.d/mariadb/data/check | 4 ++-- rootfs/etc/services.d/mariadb/finish | 4 ++-- rootfs/etc/services.d/mariadb/log/run | 2 +- rootfs/etc/services.d/mariadb/run | 7 +++---- rootfs/etc/services.d/nginx/log/run | 2 +- rootfs/etc/services.d/nginx/run | 7 ++++--- rootfs/etc/services.d/php-fpm/log/run | 2 +- rootfs/etc/services.d/php-fpm/run | 2 +- rootfs/etc/services.d/socklog/log/run | 12 +++++++++++ rootfs/etc/services.d/socklog/notification-fd | 1 + rootfs/etc/services.d/socklog/run | 8 ++++++++ rootfs/etc/services.d/zoneminder/finish | 20 +++---------------- rootfs/etc/services.d/zoneminder/log/run | 2 +- rootfs/etc/services.d/zoneminder/run | 10 +++++----- rootfs/etc/socklog.rules/forward-stdout | 3 --- rootfs/etc/socklog.rules/zoneminder-log | 6 ------ 29 files changed, 74 insertions(+), 81 deletions(-) create mode 100644 rootfs/etc/services.d/socklog/log/run create mode 100644 rootfs/etc/services.d/socklog/notification-fd create mode 100644 rootfs/etc/services.d/socklog/run delete mode 100644 rootfs/etc/socklog.rules/forward-stdout delete mode 100644 rootfs/etc/socklog.rules/zoneminder-log diff --git a/Dockerfile b/Dockerfile index a236b7d..cf61ad1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ # syntax=docker/dockerfile:experimental ARG ZM_VERSION=master ARG S6_ARCH=amd64 -ARG S6_OVERLAY_VERSION="v2.2.0.3" ##################################################################### # # @@ -44,7 +43,8 @@ RUN set -x \ COPY rootfs . RUN set -x \ - && find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix + && find . -type f -print0 | xargs -0 -n 1 -P 4 dos2unix \ + && chmod -R +x * ##################################################################### # # @@ -54,21 +54,18 @@ RUN set -x \ FROM alpine:latest as s6downloader # Required to persist build arg ARG S6_ARCH -ARG S6_OVERLAY_VERSION WORKDIR /s6downloader RUN set -x \ - && wget -O /tmp/s6-overlay.tar.gz "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.gz" \ + && S6_OVERLAY_VERSION=$(wget --no-check-certificate -qO - https://api.github.com/repos/just-containers/s6-overlay/releases/latest | awk '/tag_name/{print $4;exit}' FS='[""]') \ + && S6_OVERLAY_VERSION=${S6_OVERLAY_VERSION:1} \ + && wget -O /tmp/s6-overlay-arch.tar.xz "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64-${S6_OVERLAY_VERSION}.tar.xz" \ + && wget -O /tmp/s6-overlay-noarch.tar.xz "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch-${S6_OVERLAY_VERSION}.tar.xz" \ && mkdir -p /tmp/s6 \ - && tar zxvf /tmp/s6-overlay.tar.gz -C /tmp/s6 \ + && tar -Jxvf /tmp/s6-overlay-noarch.tar.xz -C /tmp/s6 \ + && tar -Jxvf /tmp/s6-overlay-arch.tar.xz -C /tmp/s6 \ && cp -r /tmp/s6/* . -RUN set -x \ - && wget -O /tmp/socklog-overlay.tar.gz "https://github.com/just-containers/socklog-overlay/releases/latest/download/socklog-overlay-${S6_ARCH}.tar.gz" \ - && mkdir -p /tmp/socklog \ - && tar zxvf /tmp/socklog-overlay.tar.gz -C /tmp/socklog \ - && cp -r /tmp/socklog/* . - ##################################################################### # # # Prepare base-image with core programs + repository # @@ -273,7 +270,6 @@ RUN set -x \ ENV \ S6_FIX_ATTRS_HIDDEN=1 \ S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \ - SOCKLOG_TIMESTAMP_FORMAT="" \ MAX_LOG_SIZE_BYTES=1000000 \ MAX_LOG_NUMBER=10 diff --git a/rootfs/etc/cont-init.d/00-reconfigure-user.sh b/rootfs/etc/cont-init.d/00-reconfigure-user.sh index 3611cb0..edac89c 100644 --- a/rootfs/etc/cont-init.d/00-reconfigure-user.sh +++ b/rootfs/etc/cont-init.d/00-reconfigure-user.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" program_name="reconfigure-user" diff --git a/rootfs/etc/cont-init.d/10-log-config.sh b/rootfs/etc/cont-init.d/10-log-config.sh index 439a27d..df280f7 100644 --- a/rootfs/etc/cont-init.d/10-log-config.sh +++ b/rootfs/etc/cont-init.d/10-log-config.sh @@ -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 diff --git a/rootfs/etc/cont-init.d/20-system-config.sh b/rootfs/etc/cont-init.d/20-system-config.sh index 5ec25f0..749bbed 100644 --- a/rootfs/etc/cont-init.d/20-system-config.sh +++ b/rootfs/etc/cont-init.d/20-system-config.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" program_name="system-config" @@ -11,7 +11,7 @@ ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime echo "Configuring PHP Time" | info "[${program_name}] " # PHP_INSTALL=`php -r "echo php_ini_loaded_file().PHP_EOL;"` PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION;" && echo -n "." && php -r "echo PHP_MINOR_VERSION;") -echo -n "${PHP_VERSION}" > /var/run/s6/container_environment/PHP_VERSION +echo -n "${PHP_VERSION}" > /run/s6/container_environment/PHP_VERSION echo "date.timezone = ${TZ}" >> /etc/php/"${PHP_VERSION}"/fpm/conf.d/30-zoneminder-time.ini diff --git a/rootfs/etc/cont-init.d/30-zm-config.sh b/rootfs/etc/cont-init.d/30-zm-config.sh index 92582ab..f86e963 100644 --- a/rootfs/etc/cont-init.d/30-zm-config.sh +++ b/rootfs/etc/cont-init.d/30-zm-config.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" program_name="zm-config" diff --git a/rootfs/etc/cont-init.d/40-msmtp-config.sh b/rootfs/etc/cont-init.d/40-msmtp-config.sh index bb7d357..0e52ed2 100644 --- a/rootfs/etc/cont-init.d/40-msmtp-config.sh +++ b/rootfs/etc/cont-init.d/40-msmtp-config.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" program_name="msmtp-config" diff --git a/rootfs/etc/cont-init.d/50-nginx-config.sh b/rootfs/etc/cont-init.d/50-nginx-config.sh index d2a80f4..2b8981f 100644 --- a/rootfs/etc/cont-init.d/50-nginx-config.sh +++ b/rootfs/etc/cont-init.d/50-nginx-config.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" program_name="nginx-config" diff --git a/rootfs/etc/mariadbconfigure.d/10-zoneminder-config.sh b/rootfs/etc/mariadbconfigure.d/10-zoneminder-config.sh index 5985aca..288f1b3 100644 --- a/rootfs/etc/mariadbconfigure.d/10-zoneminder-config.sh +++ b/rootfs/etc/mariadbconfigure.d/10-zoneminder-config.sh @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" # ============================================================================== # ZoneMinder-config @@ -13,9 +13,6 @@ if ! (fdmove -c 2 1 \ echo "Creating ZoneMinder db for first run" | init mysql -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" -h"${MYSQL_HOST}" < /usr/share/zoneminder/db/zm_create.sql - echo "Disabling file log to prevent duplicate logs from syslog" | init - insert_command+="UPDATE Config SET Value = -5 WHERE Name = 'ZM_LOG_LEVEL_FILE';" - echo "Configuring ZoneMinder Email settings..." | init insert_command+="UPDATE Config SET Value = 1 WHERE Name = 'ZM_NEW_MAIL_MODULES';" insert_command+="UPDATE Config SET Value = 1 WHERE Name = 'ZM_OPT_EMAIL';" @@ -32,6 +29,10 @@ else fi +# Enforce disabling of file logs +echo "Disabling file log to prevent duplicate logs from syslog" | info +insert_command+="UPDATE Config SET Value = -5 WHERE Name = 'ZM_LOG_LEVEL_FILE';" + if [[ -n "${ZM_SERVER_HOST}" ]] \ && [ "$(mysql -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" -h"${MYSQL_HOST}" zm -e \ "SELECT COUNT(*) FROM Servers WHERE Name = '${ZM_SERVER_HOST}';" \ diff --git a/rootfs/etc/services.d/fcgiwrap/finish b/rootfs/etc/services.d/fcgiwrap/finish index 119f5df..55932bc 100644 --- a/rootfs/etc/services.d/fcgiwrap/finish +++ b/rootfs/etc/services.d/fcgiwrap/finish @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" program_name="fcgiwrap" # ============================================================================== diff --git a/rootfs/etc/services.d/fcgiwrap/log/run b/rootfs/etc/services.d/fcgiwrap/log/run index 57cca2c..27efb5f 100644 --- a/rootfs/etc/services.d/fcgiwrap/log/run +++ b/rootfs/etc/services.d/fcgiwrap/log/run @@ -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}" diff --git a/rootfs/etc/services.d/fcgiwrap/run b/rootfs/etc/services.d/fcgiwrap/run index 9102179..7d37628 100644 --- a/rootfs/etc/services.d/fcgiwrap/run +++ b/rootfs/etc/services.d/fcgiwrap/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" # ============================================================================== # fcgiwrap @@ -12,4 +12,4 @@ rm /zoneminder/run/fcgiwrap.socket > /dev/null 2>&1 exec s6-setuidgid www-data \ fdmove -c 2 1 \ - fcgiwrap -f -c "${FCGIWRAP_PROCESSES}" -s unix:/zoneminder/run/fcgiwrap.socket + /usr/sbin/fcgiwrap -f -c "${FCGIWRAP_PROCESSES}" -s unix:/zoneminder/run/fcgiwrap.socket diff --git a/rootfs/etc/services.d/mariadb-configure/log/run b/rootfs/etc/services.d/mariadb-configure/log/run index ebca114..fdc653b 100644 --- a/rootfs/etc/services.d/mariadb-configure/log/run +++ b/rootfs/etc/services.d/mariadb-configure/log/run @@ -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}" diff --git a/rootfs/etc/services.d/mariadb-configure/run b/rootfs/etc/services.d/mariadb-configure/run index c10688f..269f97b 100644 --- a/rootfs/etc/services.d/mariadb-configure/run +++ b/rootfs/etc/services.d/mariadb-configure/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" # ============================================================================== # mariadb-configure @@ -6,11 +6,11 @@ # ============================================================================== # Reconfigure to be oneshot -/bin/s6-svc -O /var/run/s6/services/mariadb-configure +s6-svc -O /run/service/mariadb-configure echo "Waiting for MariaDB to start" | info # Wait for db to be up before configuring -/bin/s6-svwait -U /var/run/s6/services/mariadb +s6-svwait -U /run/service/mariadb for f in /etc/mariadbconfigure.d/*.sh; do bash "$f" diff --git a/rootfs/etc/services.d/mariadb/data/check b/rootfs/etc/services.d/mariadb/data/check index 92588d0..e83b93c 100644 --- a/rootfs/etc/services.d/mariadb/data/check +++ b/rootfs/etc/services.d/mariadb/data/check @@ -1,8 +1,8 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash for _ in {1..3}; do if ! (fdmove -c 2 1 \ - mysql -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" -h"${MYSQL_HOST}" -e 'USE zm;' \ + mysql --connect-timeout=1 -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" -h"${MYSQL_HOST}" -e 'USE zm;' \ > /dev/null); then exit 1 # mysql is not running fi diff --git a/rootfs/etc/services.d/mariadb/finish b/rootfs/etc/services.d/mariadb/finish index 37400fb..9049fdd 100644 --- a/rootfs/etc/services.d/mariadb/finish +++ b/rootfs/etc/services.d/mariadb/finish @@ -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 diff --git a/rootfs/etc/services.d/mariadb/log/run b/rootfs/etc/services.d/mariadb/log/run index 7b3ece2..ea0e51c 100644 --- a/rootfs/etc/services.d/mariadb/log/run +++ b/rootfs/etc/services.d/mariadb/log/run @@ -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}" diff --git a/rootfs/etc/services.d/mariadb/run b/rootfs/etc/services.d/mariadb/run index cef201b..f24e9f2 100644 --- a/rootfs/etc/services.d/mariadb/run +++ b/rootfs/etc/services.d/mariadb/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" # ============================================================================== # Mariadb @@ -8,13 +8,12 @@ s6-notifyoncheck -n 1000 echo "Waiting for Mariadb to start" | info # Wait until db is initially ready before polling -/bin/s6-svwait -U /var/run/s6/services/mariadb +s6-svwait -U /run/service/mariadb echo "Mariadb is up! Proceeding to monitoring." | info # Need to sleep to act like service is running # Terminate container if db dies -until ! (/var/run/s6/services/mariadb/data/check); do +until ! (/run/service/mariadb/data/check); do sleep 1 done echo "Mariadb could not be reached! Exiting..." | error -echo -n "1" > /var/run/s6/container_environment/SHUTDOWN_REASON_DB_IS_DOWN diff --git a/rootfs/etc/services.d/nginx/log/run b/rootfs/etc/services.d/nginx/log/run index 7e54cdd..45244b8 100644 --- a/rootfs/etc/services.d/nginx/log/run +++ b/rootfs/etc/services.d/nginx/log/run @@ -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}" diff --git a/rootfs/etc/services.d/nginx/run b/rootfs/etc/services.d/nginx/run index 3567e92..6d98d6c 100644 --- a/rootfs/etc/services.d/nginx/run +++ b/rootfs/etc/services.d/nginx/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" # ============================================================================== # Nginx @@ -6,8 +6,9 @@ # ============================================================================== 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;' diff --git a/rootfs/etc/services.d/php-fpm/log/run b/rootfs/etc/services.d/php-fpm/log/run index e4f7b93..20329e5 100644 --- a/rootfs/etc/services.d/php-fpm/log/run +++ b/rootfs/etc/services.d/php-fpm/log/run @@ -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}" diff --git a/rootfs/etc/services.d/php-fpm/run b/rootfs/etc/services.d/php-fpm/run index 689c93c..f7e35c3 100644 --- a/rootfs/etc/services.d/php-fpm/run +++ b/rootfs/etc/services.d/php-fpm/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" # ============================================================================== # PHP-fpm diff --git a/rootfs/etc/services.d/socklog/log/run b/rootfs/etc/services.d/socklog/log/run new file mode 100644 index 0000000..f2ebe0c --- /dev/null +++ b/rootfs/etc/services.d/socklog/log/run @@ -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}" diff --git a/rootfs/etc/services.d/socklog/notification-fd b/rootfs/etc/services.d/socklog/notification-fd new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/rootfs/etc/services.d/socklog/notification-fd @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/rootfs/etc/services.d/socklog/run b/rootfs/etc/services.d/socklog/run new file mode 100644 index 0000000..d1188be --- /dev/null +++ b/rootfs/etc/services.d/socklog/run @@ -0,0 +1,8 @@ +#!/command/with-contenv bash +. "/usr/local/bin/logger" +# ============================================================================== +# Socklog +# Starts socklog to capture logs +# ============================================================================== + +s6-socklog -d3 -t3000 diff --git a/rootfs/etc/services.d/zoneminder/finish b/rootfs/etc/services.d/zoneminder/finish index bc97e7d..d2cb044 100644 --- a/rootfs/etc/services.d/zoneminder/finish +++ b/rootfs/etc/services.d/zoneminder/finish @@ -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 diff --git a/rootfs/etc/services.d/zoneminder/log/run b/rootfs/etc/services.d/zoneminder/log/run index 878d377..52c0565 100644 --- a/rootfs/etc/services.d/zoneminder/log/run +++ b/rootfs/etc/services.d/zoneminder/log/run @@ -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}" diff --git a/rootfs/etc/services.d/zoneminder/run b/rootfs/etc/services.d/zoneminder/run index 1aaffe0..e6f7cb9 100644 --- a/rootfs/etc/services.d/zoneminder/run +++ b/rootfs/etc/services.d/zoneminder/run @@ -1,14 +1,16 @@ -#!/usr/bin/with-contenv bash +#!/command/with-contenv bash . "/usr/local/bin/logger" # ============================================================================== # ZoneMinder # Runs ZoneMinder # ============================================================================== +echo "Waiting for Socklog to start" | info +s6-svwait -U /run/service/socklog echo "Waiting for MariaDB to start" | info -/bin/s6-svwait -U /var/run/s6/services/mariadb +s6-svwait -U /run/service/mariadb echo "Waiting for mariadb-configure to complete..." | info -/bin/s6-svwait -U /var/run/s6/services/mariadb-configure +s6-svwait -U /run/service/mariadb-configure echo "Starting ZoneMinder..." | info s6-setuidgid www-data /usr/bin/zmpkg.pl start @@ -24,5 +26,3 @@ until [ "$(pgrep -fc /usr/bin/zm)" -lt "1" ]; do sleep 1 done echo "ZoneMinder has crashed! Exiting..." | error -# This is required or the container stop hangs -s6-svscanctl -t /var/run/s6/services diff --git a/rootfs/etc/socklog.rules/forward-stdout b/rootfs/etc/socklog.rules/forward-stdout deleted file mode 100644 index c576b97..0000000 --- a/rootfs/etc/socklog.rules/forward-stdout +++ /dev/null @@ -1,3 +0,0 @@ -+ -T -1 \ No newline at end of file diff --git a/rootfs/etc/socklog.rules/zoneminder-log b/rootfs/etc/socklog.rules/zoneminder-log deleted file mode 100644 index 31e1fd5..0000000 --- a/rootfs/etc/socklog.rules/zoneminder-log +++ /dev/null @@ -1,6 +0,0 @@ -- -+local1.* -nMAX_NUMBER_OF_LOGS -sMAX_SIZE_OF_LOGS -T -/log/zoneminder \ No newline at end of file