Skip to content

Commit

Permalink
Bugfix: lost $PATH in crontab
Browse files Browse the repository at this point in the history
  • Loading branch information
csandanov committed Dec 23, 2024
1 parent dc339b5 commit 99bcd4d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions 8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ RUN set -xe; \
echo -n '/usr/local/bin/gen_ssh_keys, ' ; \
echo -n '/usr/local/bin/init_container, ' ; \
echo -n '/usr/local/bin/migrate, ' ; \
echo -n '/usr/local/bin/crond, ' ; \
echo -n '/usr/local/sbin/php-fpm, ' ; \
echo -n '/usr/sbin/sshd, ' ; \
echo '/usr/sbin/crond' ; \
Expand Down
10 changes: 10 additions & 0 deletions 8/bin/crond
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -eo pipefail

if [[ -n "${DEBUG}" ]]; then
set -x
fi

# env_keep won't save PATH so we set it explicitly.
PATH="${PATH}:/home/wodby/.composer/vendor/bin:${APP_ROOT}/vendor/bin:${APP_ROOT}/bin" /usr/sbin/crond "${@}"
2 changes: 1 addition & 1 deletion 8/tests/crontab
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# min hour day month weekday command
*/1 * * * * echo "test" > /mnt/files/cron
*/1 * * * * echo "${PATH}" > /mnt/files/cron
2 changes: 1 addition & 1 deletion 8/tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ wait_for_cron() {
executed=0

for i in $(seq 1 13); do
if docker_exec crond cat /mnt/files/cron | grep -q "test"; then
if docker_exec crond cat /mnt/files/cron | grep -q "composer/vendor"; then
executed=1
break
fi
Expand Down

0 comments on commit 99bcd4d

Please sign in to comment.