Debug
DevOps Server Debug
Categories:
Store crontab response
# my_docker_crontab
# m h dom mon dow command
* * * * * echo "Hello, world!" >> /var/log/cron.log 2>&1
* * * * * /bin/bash -l -c 'cd /my/laravel/app/ && php artisan schedule:run >> /var/log/cron.log 2>&1'
/bin/sh: 1: not found
To make sure that the command is run in the /bin/bash
environment, you can modify your cron job to explicitly load the Bash environment before running the command.
# my_docker_crontab
# m h dom mon dow command
* * * * * /bin/bash -l -c 'php /path/to/your/script.php'
This will tell cron to run the command in a login shell (-l
option), which will load the Bash environment, including any environment variables and aliases that you may have defined.
The -c
option is used to specify the command to run. In this case, we’re running the php command with the path to your script as an argument.