From 7160d0f3eb5685ef7c7ad4a4c0767faf48c8a83f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 30 May 2023 12:00:18 +0200 Subject: docker: fix warnings in run_cron.sh --- docker/run_cron.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/docker/run_cron.sh b/docker/run_cron.sh index c09ba95..d23ab70 100755 --- a/docker/run_cron.sh +++ b/docker/run_cron.sh @@ -25,11 +25,6 @@ schedule_to_cron() { done } -make_task_script() { - echo "#!/bin/bash -cd -- "$( pwd )" && $( printf -- ' %q' "$@" )" -} - setup_cron_task() { local schedule schedule="${SCHEDULE:-once}" @@ -40,17 +35,14 @@ setup_cron_task() { schedule="$( schedule_to_cron "$schedule" )" - make_task_script "$@" > /task.sh - chmod +x /task.sh - - if [ -n "$SCHEDULE_ON_START" ]; then + if [ -n "${SCHEDULE_ON_START:+x}" ]; then # Run the task once when the container is started. - /task.sh + "$@" fi local crontab - crontab="$schedule /task.sh -# This is the new crontab." + crontab="$schedule" + crontab="$crontab$( printf ' %q' "$@" )" echo "$crontab" | crontab - exec crond -f -- cgit v1.2.3