-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add scheduled cron tasks for repeated actions
- Generates PDFs every few minutes - Checks plagiarism every week - Sends weekly emails - Synchronises enrolments every day
- Loading branch information
Showing
4 changed files
with
38 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
10,15,20,25,30,35,40,45,50,55 * * * * /doubtfire/lib/shell/generate_pdfs.sh | ||
0 5 * * 1,3,5 /doubtfire/lib/shell/check_plagiarism.sh | ||
0 7 * * 1 /doubtfire/lib/shell/send_weekly_emails.sh | ||
0 1 * * * /doubtfire/lib/shell/sync_enrolments.sh | ||
SHELL=/bin/bash | ||
BASH_ENV=/container.env | ||
PATH=/tmp/texlive/bin/x86_64-linux:/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin | ||
|
||
10,15,20,25,30,35,40,45,50,55 * * * * /doubtfire/lib/shell/generate_pdfs.sh > /proc/1/fd/1 2>/proc/1/fd/2 | ||
0 5 * * 1,3,5 /doubtfire/lib/shell/check_plagiarism.sh > /proc/1/fd/1 2>/proc/1/fd/2 | ||
0 7 * * 1 /doubtfire/lib/shell/send_weekly_emails.sh > /proc/1/fd/1 2>/proc/1/fd/2 | ||
0 1 * * * /doubtfire/lib/shell/sync_enrolments.sh > /proc/1/fd/1 2>/proc/1/fd/2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Start the run once job. | ||
echo "Docker container has been started" | ||
|
||
# Save the docker user environment | ||
declare -p | grep -Ev 'BASHOPTS|BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID' > /container.env | ||
cat /container.env | ||
|
||
# Ensure log is present | ||
touch /var/log/cron.log | ||
|
||
sleep 1 | ||
|
||
# Setup crontab - clear then load with file | ||
crontab -r | ||
crontab /etc/cron.d/container_cronjob | ||
|
||
echo "RESET CRONTAB" >> /var/log/cron.log | ||
|
||
|
||
# Run cron and follow log | ||
chmod 644 /etc/cron.d/container_cronjob && cron -f && tail -f /var/log/cron.log > /proc/1/fd/1 2>/proc/1/fd/2 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters