Add PATH= to beginning of a users crontab

Puts the correct PATH into a users crontab, so you no longer have to use absolute paths inside cron.
We executed it on all servers via puppet / console.

sudo su root
echo 'PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin' > /tmp/cron
crontab -l -u deploy  | grep -v PATH= >> /tmp/cron
cat /tmp/cron | crontab - -u deploy

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s