mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 15:58:13 +01:00
Adjust script paths and support run on startup
This commit is contained in:
parent
0d2d1b90c8
commit
867b14d409
2 changed files with 18 additions and 8 deletions
11
Dockerfile
11
Dockerfile
|
|
@ -7,7 +7,7 @@ WORKDIR /app
|
|||
RUN apk update && apk add --no-cache bash curl docker-cli docker-cli-compose supercronic jq regclient msmtp --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
|
||||
|
||||
# Copy the script files into the container
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
COPY entrypoint.sh /app/entrypoint.sh
|
||||
COPY dockcheck.sh /app/dockcheck.sh
|
||||
COPY urls.list /app/urls.list
|
||||
COPY notify_templates /app/notify_templates
|
||||
|
|
@ -15,11 +15,10 @@ COPY extras /app/extras
|
|||
COPY addons /app/addons
|
||||
|
||||
# Create symlink, give execution rights on the script and set proper permissions
|
||||
RUN ln -s /app/dockcheck.sh /usr/local/bin/dockcheck.sh
|
||||
RUN chmod +x /usr/local/bin/dockcheck.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /app/dockcheck.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
# Run the cron daemon in the foreground and tail the log file to keep the container running
|
||||
CMD ["supercronic", "/app/crontab"]
|
||||
CMD ["supercronic", "-passthrough-logs", "-json", "/app/crontab"]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,12 @@ 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
|
||||
echo "$CRON_SCHEDULE" /app/dockcheck.sh $DOCKCHECK_ARGS > /app/crontab
|
||||
|
||||
if [ -n "$DOCKCHECK_ONSTART" ]; then
|
||||
echo "Executing: dockcheck $DOCKCHECK_ARGS"
|
||||
/app/dockcheck.sh $DOCKCHECK_ARGS
|
||||
fi
|
||||
|
||||
# Support additional schedule variables
|
||||
for schedule_var in "${!CRON_SCHEDULE_@}"; do
|
||||
|
|
@ -14,7 +19,13 @@ if [ -n "$CRON_SCHEDULE" ] && [ -n "$DOCKCHECK_ARGS" ]; then
|
|||
schedule_value="${!schedule_var}"
|
||||
args_var="DOCKCHECK_ARGS_${suffix}"
|
||||
args_value="${!args_var}"
|
||||
echo "$schedule_value" /app/dockcheck.sh "$args_value" >> /app/crontab
|
||||
echo "$schedule_value" /app/dockcheck.sh $args_value >> /app/crontab
|
||||
|
||||
onstart_var="DOCKCHECK_ONSTART_${suffix}"
|
||||
if [ -n "${!onstart_var}" ]; then
|
||||
echo "Executing: dockcheck $args_value"
|
||||
/app/dockcheck.sh $args_value
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Crontab created."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue