Operating System - Linux
1753863 Members
7765 Online
108809 Solutions
New Discussion юеВ

Re: sh: command not found

 
Piotr Kirklewski
Super Advisor

sh: command not found

Hi there

When I'm running:
'mongrel_rails cluster::restart' from command line it's fine.

When I'm running this command from program I'm heving this error:

sh: mongrel_rails: command not found

The command is in /usr/local/bin - which is in user PATH:
newsfeeder@webserver2:~$ $PATH
-bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games

Can enyone help ?

Best Regards

Peter

Jesus is the King
3 REPLIES 3
Stuart Browne
Honored Contributor

Re: sh: command not found

From what program? How is the program launched?

It will be a path issue, and it all dependson how the program is launched.
One long-haired git at your service...
Ivan Ferreira
Honored Contributor

Re: sh: command not found

The user environment could not be available depending on how you run the program.

If you can, define the PATH variable inside the program/script, source the user's profile at run time or specify the full path to the program when is called.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Matti_Kurkela
Honored Contributor

Re: sh: command not found

If /usr/local/bin/mongrel_rails exists and is accessible (scripts must be both readable & executable to work), the error message might mean that the interpreter of mongrel_rails cannot be found.

Run "head /usr/local/bin/mongrel_rails".
The first line should be something like:

#!/script/interpreter/path

Make sure the /script/interpreter/path is a correct full pathname of the correct script interpreter.

I'm not familiar with mongrel_rails, but a quick Googling suggests that it should be something like:

#!/opt/ruby/bin/ruby1.8
(or whatever your ruby version is & wherever your ruby installation is located)

MK
MK