AWS CLI – not working in a crontab

awscron

I can run the command aws --version in a script and in the cli. But if I put this command into a crontab it does not work.

Crontab:

50 12 * * * aws --version > ~/yolo.swag

Error:

/bin/sh: 1: aws: not found

The aws command is in a bash script. And I get the same error message when I run the script in cron. How can I get the script to run the command fine ?

Best Answer

You need to specify the full path to the aws executable:

50 12 * * * /usr/local/bin/aws --version > ~/yolo.swag
Related Question