Paper Lantern for cPanel accounts is being retired this year. Find out more »
cPanel & WHM Version 102 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Add PATH variable to crontab

Jason Brown shared this idea 2 years ago
Need More Information

As a user of the cPanel interface, I would like the "Add New Cron Job" feature to add the user's current PATH variable to the crontab so that the exact link to binaries do not need to be called.


Currently, by default, if you add a cronjob, the only PATH used is the following:

 /usr/bin:/bin

This causes crons dependent on binaries and scripts that aren't in these locations to require the full path.


An example of a typical user's PATH would be this:

/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/cpanel/composer/bin:/home/user/.local/bin:/home/user/bin

Implementing this change would allow users to set "git" as the cron command rather than /usr/local/cpanel/3rdparty/lib/path-bin/git

Replies (1)

photo
1

Howdy,

Wanting to get a bit more information on this to better understand the issue. Are you currently updating your PATH in bashrc?


Dustin Scherer (he/him) | Product Owner | @dustinscherer

photo
1

Howdy back,


It's possible that the PATH was updated in .bashrc in my example (user/.local/bin does not appear in cpanel defaults), but I think the mvp would be at least the PATH that users have by default from /etc/bashrc if not considering customized paths.

photo
Leave a Comment
 
Attach a file