aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docker/run_cron.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-30 12:00:18 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-30 12:00:18 +0200
commit7160d0f3eb5685ef7c7ad4a4c0767faf48c8a83f (patch)
treec1d7159a2d1df68acc0f942c6584e828bef43532 /docker/run_cron.sh
parentdocker: add SCHEDULE=minutely support to run_cron.sh (diff)
downloadcgitize-7160d0f3eb5685ef7c7ad4a4c0767faf48c8a83f.tar.gz
cgitize-7160d0f3eb5685ef7c7ad4a4c0767faf48c8a83f.zip
docker: fix warnings in run_cron.sh
Diffstat (limited to '')
-rwxr-xr-xdocker/run_cron.sh16
1 files 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