0

I am porting from SuseLinux to CentOS

Default Path Variable of cronjob in Suse Linux was - PATH=/usr/bin:/bin All the Application Scripts worked fine in Suse Linux.

Now in CentOS, many binaries have been moved to /usr/sbin directories.

Now when these application scripts are run from cron job in CentOS they do not work because cron job default PATH in Centos is also PATH=/usr/bin:/bin. So these Cron scripts cannot access binaries present in /sbin or /usr/sbin directories.

Have to make PATH variable like PATH=/usr/bin:/bin:/usr/sbin So that all my application scripts work.

I don't want to change Application Scripts and give the full path to all the binaries in these scripts. As it would produce many changes.

Setting PATH variable on top of Cron Script when the application installs and removing it when the application uninstalls, and even making changes during application upgrade also seems a lot of work.

I wanted to know the optimal or less work solution It would be better if the change involves is in application side and I don't have to make changes in OS rpm.

kvantour
  • 25,269
  • 4
  • 47
  • 72
Mayank Kataruka
  • 395
  • 1
  • 2
  • 11

1 Answers1

0

Centos is based on Redhat Enterprise Linux which makes use of vixie-cron. This allows you to change the path in the crontab file.

PATH=/usr:/usr/bin:/path/to/something/else
1 2 * * * command 

More Information:

kvantour
  • 25,269
  • 4
  • 47
  • 72