Crontab is not using PATH written in /etc/environment

Viewed 89

I am loading environment variables to crontab by writting those variables in /etc/environment. One of the variables I need to use is PATH. Although I am writting the PATH to the /etc/enviroment I see that cron uses another value of PATH still.

My /etc/environemnt:

# cat /etc/environment
...
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
...

The output of cron when it logs the output of env

...
PATH=/usr/bin:/bin
...

I managed to solve the issue by hardcoding the desired PATH to the cron job file, however I would prefer writing the PATH dynamically based on the actual PATH

0 Answers
Related