From 5ec5a723d2b23bb2252b365d4e763c94c7bb3ae1 Mon Sep 17 00:00:00 2001 From: tarkil Date: Thu, 28 Mar 2024 18:23:41 +0800 Subject: [PATCH] changed structure + few fixes --- Dockerfile | 12 ++++++------ crontab | 2 -- rsync-script.sh => scripts/rsync-script.sh | 0 start-cron.sh => scripts/start-cron.sh | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) delete mode 100644 crontab rename rsync-script.sh => scripts/rsync-script.sh (100%) rename start-cron.sh => scripts/start-cron.sh (60%) diff --git a/Dockerfile b/Dockerfile index 6048891..478408f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ # Use the Alpine base image FROM alpine:latest -# Install cron -RUN apk add --no-cache dcron +# Install cron, rsync, and bash +RUN apk add --no-cache dcron rsync bash # Copy the rsync script and the start-cron script into the Docker image -COPY rsync-script.sh /path/to/rsync-script.sh -COPY start-cron.sh /start-cron.sh +COPY scripts/rsync-script.sh /scripts/rsync-script.sh +COPY scripts/start-cron.sh /scripts/start-cron.sh # Make the scripts executable -RUN chmod +x /path/to/rsync-script.sh /start-cron.sh +RUN chmod +x /scripts/rsync-script.sh /scripts/start-cron.sh # Run the start-cron script when the container starts -CMD ["/start-cron.sh"] \ No newline at end of file +CMD ["/scripts/start-cron.sh"] \ No newline at end of file diff --git a/crontab b/crontab deleted file mode 100644 index 5d0b5b1..0000000 --- a/crontab +++ /dev/null @@ -1,2 +0,0 @@ -0 2 * * * /rsync-script.sh >> /var/log/cron.log 2>&1 -# Don't remove the empty line at the end of this file. It is required to run the cron job diff --git a/rsync-script.sh b/scripts/rsync-script.sh similarity index 100% rename from rsync-script.sh rename to scripts/rsync-script.sh diff --git a/start-cron.sh b/scripts/start-cron.sh similarity index 60% rename from start-cron.sh rename to scripts/start-cron.sh index fd98059..651e123 100644 --- a/start-cron.sh +++ b/scripts/start-cron.sh @@ -1,7 +1,7 @@ #!/bin/sh # Write a new crontab file -echo "${CRON_FREQUENCY} /path/to/rsync-script.sh >> /var/log/cron.log 2>&1" > /etc/crontab +echo "${CRON_FREQUENCY} /scripts/rsync-script.sh >> /var/log/cron.log 2>&1" > /etc/crontab # Start the cron service cron -f \ No newline at end of file