Fix: nextcloud notify script issues

This commit is contained in:
coolnsx
2025-09-17 16:22:20 +05:30
parent 269f944dd2
commit 8ca1d21f51
2 changed files with 18 additions and 19 deletions

View File

@@ -1,5 +1,4 @@
#!/bin/sh
set -e
NC_PATH="/var/www/html"
CONFIG="$NC_PATH/config/config.php"
@@ -9,32 +8,31 @@ 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
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
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=$((i+1))
sleep 1
: $((i += 1))
done
# Keep container alive while notify_push runs
wait "$NOTIFY_PID"
wait

View File

@@ -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