mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 07:48:14 +01:00
Docker configuration
This commit is contained in:
parent
fc0b1a2505
commit
0d2d1b90c8
4 changed files with 71 additions and 1 deletions
26
entrypoint.sh
Normal file
26
entrypoint.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
# If the CRON_SCHEDULE and DOCKCHECK_ARGS environment variables are set, create the crontab entry for the dockcheck user
|
||||
if [ -n "$CRON_SCHEDULE" ] && [ -n "$DOCKCHECK_ARGS" ]; then
|
||||
# Write the environment variable content to a temporary file, ensuring a newline at the end
|
||||
echo "$CRON_SCHEDULE" /app/dockcheck.sh "$DOCKCHECK_ARGS" > /app/crontab
|
||||
|
||||
# Support additional schedule variables
|
||||
for schedule_var in "${!CRON_SCHEDULE_@}"; do
|
||||
suffix="${schedule_var#CRON_SCHEDULE_}"
|
||||
schedule_value="${!schedule_var}"
|
||||
args_var="DOCKCHECK_ARGS_${suffix}"
|
||||
args_value="${!args_var}"
|
||||
echo "$schedule_value" /app/dockcheck.sh "$args_value" >> /app/crontab
|
||||
done
|
||||
|
||||
echo "Crontab created."
|
||||
else
|
||||
echo "No CRON_SCHEDULE or DOCKCHECK_ARGS environment variable(s) found. No crontab created."
|
||||
fi
|
||||
|
||||
# Pass control to the CMD command specified in the Dockerfile
|
||||
exec "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue