Hands-on task
Fix PATH for a cron job
Cron runs jobs with a minimal environment (PATH=/usr/bin:/bin), so /opt/deploy.sh can't find the deployctl utility and fails. Without touching the script itself, set the PATH variable in the root crontab to include /usr/local/bin:/usr/bin:/bin, and add an hourly run of /opt/deploy.sh (at the top of every hour).
The job must work when run the way cron runs it — with an empty environment and only the variables from the crontab. A successful run appends a deployed … line to /var/log/deploy.log.
- cron
- environment variables
- PATH
- crontab