From 8ca1d21f51577e9629c38390996ff554222d621e Mon Sep 17 00:00:00 2001 From: coolnsx Date: Wed, 17 Sep 2025 16:22:20 +0530 Subject: [PATCH] Fix: nextcloud notify script issues --- nextcloud/nextcloud-notify-push-entrypoint.sh | 34 +++++++++---------- nextcloud/nextcloud_push.container | 3 +- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/nextcloud/nextcloud-notify-push-entrypoint.sh b/nextcloud/nextcloud-notify-push-entrypoint.sh index 711001c..546fa43 100755 --- a/nextcloud/nextcloud-notify-push-entrypoint.sh +++ b/nextcloud/nextcloud-notify-push-entrypoint.sh @@ -1,5 +1,4 @@ #!/bin/sh -set -e NC_PATH="/var/www/html" CONFIG="$NC_PATH/config/config.php" @@ -8,33 +7,32 @@ SOCKET_PATH="${SOCKET_PATH:-/tmp/docker/notify_push.sock}" # Clean shutdown handler cleanup() { - echo "[*] Stopping notify_push..." - kill -TERM "$NOTIFY_PID" 2>/dev/null || true - wait "$NOTIFY_PID" 2>/dev/null || true + echo "[*] Stopping notify_push..." + kill -TERM "$NOTIFY_PID" 2>/dev/null && echo "[*] notify push stopped.." || echo "Unable to Kill Notify Push.." + echo "[*] Bye" } trap 'cleanup' TERM INT -echo "[*] Ensuring notify_push app is installed/updated..." -php occ app:install notify_push 2>/dev/null || true -php occ app:update notify_push 2>/dev/null || true +echo "[*] Ensuring notify_push app is installed and enabled..." +php occ app:install notify_push || true +php occ app:enable notify_push || true echo "[*] Starting notify_push binary..." "$NOTIFY_BIN" "$CONFIG" & NOTIFY_PID=$! # Wait for the socket to appear, max 30 seconds -echo "[*] Waiting for notify_push to be ready..." i=0 -while [ $i -lt 30 ]; do - if [ -S "$SOCKET_PATH" ]; then - echo "[*] Socket found, running occ notify_push:setup" - php occ notify_push:setup "${NEXTCLOUD_URL}/push" || true - break - fi - i=$((i+1)) - sleep 1 +while [ $i -lt 6 ]; do + echo "[*] Waiting 5 seconds for notify_push to be ready... (try $i/6)" + sleep 5 + if [ -S "$SOCKET_PATH" ]; then + echo "[*] Socket found, running occ notify_push:setup" + php occ notify_push:setup "${NEXTCLOUD_URL}/push" || true + break + fi + : $((i += 1)) done # Keep container alive while notify_push runs -wait "$NOTIFY_PID" - +wait diff --git a/nextcloud/nextcloud_push.container b/nextcloud/nextcloud_push.container index 92337ec..fe74ae7 100644 --- a/nextcloud/nextcloud_push.container +++ b/nextcloud/nextcloud_push.container @@ -7,8 +7,9 @@ After=nextcloud_db.service nextcloud_valkey.service nextcloud.service Pod=nextcloud.pod ContainerName=nextcloud_push Image=docker.io/library/nextcloud:fpm-alpine -Exec=/nextcloud-notify-push-entrypoint.sh +Entrypoint=/nextcloud-notify-push-entrypoint.sh User=1000 +Group=1000 # Enable auto-update container AutoUpdate=registry