ubuntu 20.04 cronjob at restart not working
Solution 1:
Jobs run through cron
aren't run in the same runtime environment that you have on your desktop. None of your PATH
changes, or other environment variable settings from ~/.bashrc
are automatically propagated to your cron
job. For example, there's no $DISPLAY
, so GUI programs need special treatment (read man xhost
). In your case, your script is probably looking for, and not finding docker-compose
in your $PATH
.
One can set environment variables for all one's cron
jobs in the crontab
file
Read man 5 crontab
.
Look at the results of echo "=== id ===";id;echo "=== set ===";set;echo "=== env ===";env | sort;echo "=== alias ===";alias
in each of your environments.