Docker
Reset crontab file before adding the cron expression to prevent multiplying the same entry on every container restart Fixes #1
This commit is contained in:
parent
412347f3a8
commit
6e03f209ef
1 changed files with 6 additions and 2 deletions
|
@ -1,7 +1,11 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
if [ ! -z "$CRON_EXPRESSION" ]; then
|
||||
(crontab -l 2>/dev/null; echo "$CRON_EXPRESSION /script/immich_auto_album.sh > /proc/1/fd/1 2>/proc/1/fd/2") | crontab -
|
||||
CRONTAB="$CRON_EXPRESSION /script/immich_auto_album.sh > /proc/1/fd/1 2>/proc/1/fd/2"
|
||||
# Reset crontab
|
||||
crontab -r
|
||||
(crontab -l 2>/dev/null; echo "$CRONTAB") | crontab -
|
||||
|
||||
# Make environment variables accessible to cron
|
||||
printenv > /etc/environment
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue