Sebastian
Sebastian

Reputation: 923

Ubuntu Shellscript Path Variable

I have the following Shellscript that I call from my crontab, which works fine until it calls php code that involves shell commands like wget or find.

#!/bin/sh
PATH=/opt/server/php/bin:/usr/bin/wget:/bin/egrep:/usr/bin/find
cd /opt/server/apache2/htdocs/webapp/ 
php oil refine job:handler

For each Command I did a which command to look up the path, then I added it to the Path Variable. Nevertheless it does not find the commands and I get messages like these:

sh: wget: not found
sh: find: not found

How would I fix this? I know that this is a common problem, but I didn't find a good explanation for this here on stackoverflow. Also: I know that calling the script from bash versus crontab might result in different enviroment settings, but eitherway I get these Errors.

Upvotes: 1

Views: 241

Answers (1)

Zombo
Zombo

Reputation: 1

Good sir, the PATH is a string that describes the directories that contain executables, not the executables themselves.

Perhaps use something like this

PATH=/opt/server/php/bin:/usr/bin:/bin

Upvotes: 1

Related Questions