Updated Approach to Scheduling
This commit is contained in:
parent
4fdaf788b5
commit
9038a7c9b2
12
Dockerfile
12
Dockerfile
@ -2,17 +2,13 @@ FROM ubuntu:latest
|
|||||||
|
|
||||||
# Install necessary packages
|
# Install necessary packages
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y git curl cron rsync
|
apt-get install -y git curl rsync
|
||||||
|
|
||||||
# Add script and cronjob
|
# Add script
|
||||||
COPY repo_watcher.sh /root/Repo_Watcher/repo_watcher.sh
|
COPY repo_watcher.sh /root/Repo_Watcher/repo_watcher.sh
|
||||||
COPY crontab.txt /crontab.txt
|
|
||||||
|
|
||||||
# Make script executable
|
# Make script executable
|
||||||
RUN chmod +x /root/Repo_Watcher/repo_watcher.sh
|
RUN chmod +x /root/Repo_Watcher/repo_watcher.sh
|
||||||
|
|
||||||
# Apply cron job
|
# Start script
|
||||||
RUN crontab /crontab.txt
|
CMD ["/bin/bash", "-c", "/root/Repo_Watcher/repo_watcher.sh"]
|
||||||
|
|
||||||
# Start cron in foreground
|
|
||||||
CMD ["cron", "-f"]
|
|
@ -1,4 +0,0 @@
|
|||||||
**Basic Docker Run Command**:
|
|
||||||
```
|
|
||||||
docker run -e REPO_URL='https://your.git.repo.url' -e COPY_DIR='/your/copy/dir' -e NTFY_URL='https://your.ntfy.url' -e GIT_USERNAME='your_username' -e GIT_PASSWORD='your_password' git_repo_updater
|
|
||||||
```
|
|
@ -1 +0,0 @@
|
|||||||
* * * * * /bin/bash /root/Repo_Watcher/repo_watcher.sh
|
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
|
||||||
# Fetch environment variables
|
# Fetch environment variables
|
||||||
repo_url=$REPO_URL
|
repo_url=$REPO_URL
|
||||||
copy_dir=$COPY_DIR
|
copy_dir=$COPY_DIR
|
||||||
@ -43,3 +45,8 @@ elif [ $REMOTE = $BASE ]; then
|
|||||||
else
|
else
|
||||||
echo "Data diverged"
|
echo "Data diverged"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Wait for 5 seconds before the next iteration
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user