Files
nsupdate/docker/entrypoint.sh
Christian Busch 852da10d2e
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 36s
Fixed docker
2026-04-26 19:51:09 +02:00

45 lines
1.1 KiB
Bash

#!/bin/sh
set -e
COMMAND="/usr/local/bin/nsupdate.sh"
# Default schedule if not specified
SCHEDULE="${SCHEDULE:-* * * * *}"
# Default cron log level if not specified
CRON_LOG_LEVEL="${CRON_LOG_LEVEL:-2}"
# Default user name not specified
USERNAME="${USERNAME:-nsupdate}"
# Default UID and GID if not specified
PUID=${PUID:-1000}
PGID=${PGID:-1000}
# Default timezone if not specified
TZ=${TZ:-Etc/UTC}
# Set the timezone
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo "$TZ" >/etc/timezone
echo "Timezone set to $TZ"
# Create nsupdate group
addgroup -S --gid $PGID "$USERNAME"
# Create nsupdate user
adduser -S -u $PUID -G "$USERNAME" -D -H -s /bin/false "$USERNAME"
CRON_FILE="/etc/crontabs/$USERNAME"
mkdir -p /etc/crontabs
printf '%s %s %s\n' "$SCHEDULE" "$USERNAME" "$COMMAND" > "$CRON_FILE"
chmod 600 "$CRON_FILE"
# Set correct permissions
chown -R "$USERNAME":"$USERNAME" /config
chown -R "$USERNAME":"$USERNAME" /log
echo "Permissions adjusted"
# Start nsupdate in the foreground with reduced warnings
echo "Starting cron..."
exec crond -l "${CRON_LOG_LEVEL}" -f