LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2010, 02:14 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 36
Error Executing the script.


Code:
# cat SERVERNAMES
10.180.8.231
10.180.8.232
10.180.8.233
10.180.8.234
10.180.8.235
10.180.8.236
10.180.8.237
10.180.8.238
10.180.9.239

Code:
fn_Exit()
{
echo "Machine Doesnt exist"
exit 1 #exit shell script
}


echo "Please Enter Guest Name:"
read VM_GUEST

PATH=$(ssh -ttq root@10.180.8.231 find /var/ovs/mount -name *$VM_GUEST)
if [ -z "$PATH" ]
then
fn_Exit
else
echo "Machine Exists"
fi

fn_VMServerSearch()
{
MACHINEEXISTFLAG=$(ssh -T -q -n root@$1 xm list | grep $2)
if [ ! -z "$MACHINEEXISTFLAG" ]
then
echo "Machine $VM_GUEST Is Found At $1"
fi
}

#To Check The ServerName of Guest Machine.
while read line
do
fn_VMServerSearch "$line" "$VM_GUEST"
done < SERVERNAMES
Whenever i execute the above script i m getting following error.

Code:
# ./vm_finder_mod_V2.cgi
Please Enter Guest Name:
WIN2003-SP2
Machine Exists
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
./vm_finder_mod_V2.cgi: line 85: ssh: command not found
./vm_finder_mod_V2.cgi: line 85: grep: command not found
However If i execute the code by excluding .
Code:
PATH=$(ssh -ttq root@10.180.8.231 find /var/ovs/mount -name *$VM_GUEST)
if [ -z "$PATH" ]
then
fn_Exit
else
echo "Machine Exists"
fi
I get the proper output.

What can be the issue?
I m confuesed.

Last edited by pinga123; 07-20-2010 at 02:58 AM.
 
Old 07-20-2010, 02:18 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
That can't be the same script - it doesn't have 85 lines to begin with.
 
Old 07-20-2010, 02:31 AM   #3
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by Tinkster View Post
That can't be the same script - it doesn't have 85 lines to begin with.
I m sorry . I had removed the commented part from the script. 85 line points to
Code:
MACHINEEXISTFLAG=$(ssh -T -q -n root@$1 xm list | grep $2)
I find it hard to understand why this is happening?

Last edited by pinga123; 07-20-2010 at 02:35 AM.
 
Old 07-20-2010, 02:49 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
The script is called .cgi ... to me that suggests that it's run
as part of a web-app. As such it will be run by the apache user
(httpd, apache, websomething, ...) who won't have them in the
PATH. Try specifying the full paths for both commands.
 
Old 07-20-2010, 02:55 AM   #5
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by Tinkster View Post
The script is called .cgi ... to me that suggests that it's run
as part of a web-app. As such it will be run by the apache user
(httpd, apache, websomething, ...) who won't have them in the
PATH. Try specifying the full paths for both commands.
This is just a test file .Even after renaming .cgi to sh and running the scriptlet results in the same error.
 
Old 07-20-2010, 04:06 AM   #6
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
I got the error .
I had used PATH as a variable for storing application level information.
 
Old 07-20-2010, 02:32 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by pinga123 View Post
I got the error .
I had used PATH as a variable for storing application level information.
LOL ...

Well done for finding it, anyway ;}

And thanks for marking it as solved.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Error Executing a script(SSH problem) pinga123 Linux - Newbie 5 07-14-2010 01:54 PM
[SOLVED] Error Executing the script. pinga123 Linux - Newbie 3 07-08-2010 11:34 PM
Error executing Perl/CGI script loftus49 Fedora 6 06-10-2010 04:41 AM
Sntax error : unexpected end of file while executing shell script priyankarathi Linux - Newbie 5 04-21-2009 02:33 AM
Executing PHP script- error message vfulco Linux - Newbie 3 07-13-2004 11:55 PM


All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration