Thursday, 20 June 2019

How to set cron PATH globally (i.e. for all users) permanently?

We need to have /usr/local/bin in cron's path for all users. Is there a way to set it system-wide, without needing to edit each individual user's crontab?


We've tried adding PATH to /etc/crontab:


# grep PATH /etc/crontab
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

But when users have this in their crontab:


$ crontab -l | grep PATH
* * * * * echo $PATH > /tmp/current_cron_path

...it reveals that their path is still set to default:


$ cat /tmp/current_cron_path
/usr/bin:/bin

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...