Skip to content
Snippets Groups Projects
Commit 42ebe464 authored by Joost Hemmen's avatar Joost Hemmen :basketball:
Browse files

Merge branch '91-create-sftp-sync-job' into 'main'

Resolve "create sftp sync job"

Closes #91

See merge request !141
parents fc3fd822 ec183e23
No related branches found
No related tags found
1 merge request!141Resolve "create sftp sync job"
Pipeline #378086 passed
......@@ -3,7 +3,7 @@ ARG DEBIAN_IMAGE_TAG
FROM debian:${DEBIAN_IMAGE_TAG}
RUN apt-get update \
&& apt-get install -y --no-install-recommends cron tini python3 python3-pip\
&& apt-get install -y --no-install-recommends cron tini python3 python3-pip inotify-tools\
&& rm -rf /var/lib/apt/\
&& rm -rf /etc/cron.*/*
......
......@@ -2,13 +2,26 @@
set -e
if [ "$SETUP_SERVICE" == "true" ]; then
echo "SETUP_SERVICE has value '$SETUP_SERVICE' - starting cron setup."
# Function to update crontab from crontab.txt
update_crontab() {
# prepend environment variables to /tmp/new_crontab.txt
# to be able topass them to cron jobs
(printenv; cat /tmp/crontab.txt) > /tmp/new_crontab.txt
# use /tmp/new_crontab.txt as crontab
crontab /tmp/new_crontab.txt
}
if [ "$SETUP_SERVICE" == "true" ]; then
echo "SETUP_SERVICE has value '$SETUP_SERVICE' - starting cron setup."
# Monitor crontab.txt for changes and update crontab if they occurr
# run loop in background to start cron service
while true; do
update_crontab
inotifywait -e modify /tmp/crontab.txt
done &
sleep 1
cron -f || exit 1
echo "cron setup complete."
else
echo "SETUP_SERVICE has value '$SETUP_SERVICE' - skipping cron setup."
echo "To start cron setup, set SETUP_SERVICE to 'true' in .env file."
fi
\ No newline at end of file
fi
psycopg2-binary~=2.9.2
\ No newline at end of file
psycopg2-binary~=2.9.2
python-crontab~=3.0.0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment