Skip to content

Commit

Permalink
Ensure single instance on Debian image
Browse files Browse the repository at this point in the history
  • Loading branch information
claabs committed Dec 10, 2021
1 parent 31559b6 commit 6a08a53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ if [ "$RUN_ONCE" = "false" ]; then
else
# Debian cron wipes the environment, so we save it to a script to load in cron
printenv | sed 's/^\(.*\)$/export \1/g' > /root/project_env.sh
# Add the command to the crontab
echo "${CRON_SCHEDULE} . /root/project_env.sh && cd /usr/app && node /usr/app/dist/src/index.js > /proc/1/fd/1 2>/proc/1/fd/2" | crontab -
# Add the command to the crontab. Debian cron doesn't ensure single instance, so we use flock to ensure it
echo "${CRON_SCHEDULE} . /root/project_env.sh && cd /usr/app && flock -n /var/lock/epicgames.lock node /usr/app/dist/src/index.js > /proc/1/fd/1 2>/proc/1/fd/2" | crontab -
# Run the cron process. The container should halt here and wait for the schedule.
cron -f
fi
Expand Down

0 comments on commit 6a08a53

Please sign in to comment.