ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Neuberger <Nick.Neuber...@sncc.com>
Subject RE: Sshexec fail on starting a service (websphere)
Date Thu, 04 Mar 2004 20:24:45 GMT
I also ran the commands using JCTerm which uses jsch as well.

It definietly seems like a problem with jsch then.  If the "channel.isEOF()"
should always get eof after a a command is sent, it should release even if a
process (java -websphere) was spanned.  It sure looks like sshexec is
getting back a [ OK ] response.  It's just failing on the timeout.  Note - I
can get the sshexec to pass without hitting timeout, but I have to stop the
websphered process before the timeout.  SSHExec is then successful.  This
defeats the purpose.

I really don't think creating a script for each "command" that I need to
call just to return a success / fail.  I'm responsible for about 15 servers,
that would require a script for each command, to go to each server....just
to get the sshexec task to work with a command.  The task severly lacks
something then.  Why not give the developer the 'option' to choose what is
success or failure.

Like I said a call to command="echo" will always produce a success.  Why
have to write a script just to call a command, to tell the sshexec task if
it failed or not.  SSHexec needs something.....maybe hit the timeout, then
check a pass/fail attribute.....

I'm just trying to suggest a "feature"...as this is an open-source project.

Just a thought.....No harm intended....e-mail tends to get things
out-of-context.

Do you know who is the developer of jsch.....or a mailing list to send my
troubles too....

Much thanks...

Nick Neuberger



-----Original Message-----
From: Anderson, Rob (Global Trade) [mailto:Rob.Anderson@nike.com]
Sent: Thursday, March 04, 2004 1:20 PM
To: Ant Users List
Cc: dev@ant.apache.org
Subject: RE: Sshexec fail on starting a service (websphere)


Comments below...

> -----Original Message-----
> From: Nick Neuberger [mailto:Nick.Neuberger@sncc.com]
> Sent: Thursday, March 04, 2004 10:35 AM
> To: 'Ant Users List'
> Subject: RE: Sshexec fail on starting a service (websphere)
> 
> 
> Yes.  The command exits properly...  I never have to force 
> the script to
> end.  It ends properly.  Just not via ant/sshexec.
> 
> [user@machine1 etc]# /etc/init.d/websphered stop
> Shutting down websphered:                                  [  OK  ]
> [user@machine1 etc]# /etc/init.d/websphered start
> Starting websphered:                                       [  OK  ]
> [user@machine1 etc]#
> 
> I don't think the problem is sshd.  At least it doesn't seem to be the
> problem.  I'm using ssh/putty.exe on windows to connect to 
> the server.  I
> may be able to try the jsch/ssh client and connect and run 
> the same command.
> see if it hangs then.  If you no what I mean.
> 
> BTW - I'm using jsch-0.1.12.jar   Maybe there is a new 
> version of it, that
> may help...Thoughts??
> 
> The sshexec mod that I suggested is basically passively 
> fixing the problem.
> I agree with you....making a mod the SshExec doesn't really 
> fix the problem.
> 
> 
> It would only allow the ant developer to "pass" or "fail" based on a
> specific criteria received from the output.  When I first 
> started using the
> task, there was this disconnect that I had about the task.  I 
> still believe
> a change such as this would aid in making the sshexec task easier for
> developers.
> 
> ie. THIS IS PURELY AN example.
> <sshexec command="echo $PATH"
> passon="/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin"
> failon="/usr/local/bin"/>

The sshexec task is meant to contain functionality that is in ssh. Since the
functionality mentioned above is not part of ssh, this would be outside of
the scope of the sshexec task. The sshexec task does however examine the
exit status of the command.   

> 
> The above "echo" command will always pass an exit status 0.  
> There is no way
> of determine a pass or fail without having to write a bash 
> script on the
> server and it send the pass / fail signal.
> 

In the case above, you would want to write a script that evaluates the $PATH
and exit with the appropriate status, then execute this script with sshexec.

> Or at least a sub task within SSHExec to read the output and 
> pass / fail
> based on another ant task. ifdef....etc.

Exit status is the best way to evaluate success or failure, and I see no
benefit in adding other requirements to determining success or failure. 

> 
> Thoughts?

Perhaps you should write a wrapper script "reads" the output from
/etc/init.d/websphere and exits with status code 0 when it reads the
expected output fromt the start command. I really don't think that this
issue should be addressed by the sshexec task. Now if there is an issue of
compatibility with the sshd on the remote side, let's address that and fix
sshexec or jsch to work as expected. The suggested modifications to the
sshexec task are outside of the scope of the sshexec task and really do not
address the problem you are having.

I encourage the committers to express their views.

-Rob Anderson

> 
> Nick Neuberger
> 
> 
> 
> -----Original Message-----
> From: Anderson, Rob (Global Trade) [mailto:Rob.Anderson@nike.com]
> Sent: Thursday, March 04, 2004 11:32 AM
> To: Ant Users List
> Cc: dev@ant.apache.org
> Subject: RE: Sshexec fail on starting a service (websphere)
> 
> 
> Perhaps the problem is not with the script, but with the sshd 
> running on the
> remote machine. Are you able to get an exit status 0 from the 
> following
> command?
> 
> ssh user@host "/etc/init.d/websphere start"
> 
> Does this command exit properly once the server is started?
> 
> I am reluctant to approve of edits to the sshexec task that 
> are specific to
> a single command that users might run on the remote machine. 
> I think the
> commiters will agree. 
> 
> -Rob Anderson
> 
> > -----Original Message-----
> > From: Nick Neuberger [mailto:Nick.Neuberger@sncc.com]
> > Sent: Thursday, March 04, 2004 7:26 AM
> > To: 'Ant Users List'
> > Subject: RE: Sshexec fail on starting a service (websphere)
> > 
> > 
> > "The remote script should background the process and exit"
> > 
> > I'm not too good with editing bash (websphered) scripts, but 
> > it sure seems
> > like the script is sending a success message.  This is a 
> cookie cutter
> > script from ibm/websphere.  Here is a snippet of the script.
> > 
> >     start)
> >     echo -n "Starting websphered: "
> >     # /opt/WebSphere/AppServer/bin/startServer.sh $args > /dev/null
> >     $START_SCRIPT $args >/dev/null
> >     RETVAL=$?
> >     if [ $RETVAL = 0 ]; then
> >          touch /var/lock/subsys/websphered
> >          echo_success
> >          else
> >          echo_failure
> >          fi
> >     echo
> >     ;;
> > 
> > These scripts work perfectly fine outside of ant / sshexec?  
> > Shouldn't there
> > be a change inside sshexec/jsch.  The script properly exits 
> > when called
> > directly just not from ant/sshexec.  The proper response is 
> > "echo_success".
> > 
> > Do you see my delimma?   Thats why I'm considering a change 
> > to SshExec.java.
> > Wait for the timeout but allow the "ant" developer to easily 
> > determine if
> > its a fail / success as well.
> > 
> > Thanks for the response!!!
> > 
> > Nick Neuberger
> > 
> > 
> > -----Original Message-----
> > From: Anderson, Rob (Global Trade) [mailto:Rob.Anderson@nike.com]
> > Sent: Wednesday, March 03, 2004 5:04 PM
> > To: Ant Users List
> > Subject: RE: Sshexec fail on starting a service (websphere)
> > 
> > 
> > serverStart.sh starts the Admin server, correct? I would 
> > suggest leaving the
> > admin server running unless it is absolutely necessary to 
> > shut it down. You
> > could probably just stop/start your Application Server 
> instance(s), or
> > perhaps even just your Enterprise Appliations, with a wscp.sh 
> > one-liner.
> > 
> > If the script you are running never exits becuase it calls a 
> > foreground
> > process that continues to run, the expected behavior of ssh, 
> > sshexec, and
> > jsch is a timeout. The remote script should background the 
> > process and exit,
> > returning an exit status to sshexec. This exit status is used 
> > to determine
> > success or failure. Ssh, sshexec, and jsch are not supposed 
> > to "notice" that
> > something has been started successfully, that should be up to 
> > your script to
> > return the proper exit status.
> > 
> > -Rob Anderson
> > 
> > > -----Original Message-----
> > > From: Nick Neuberger [mailto:Nick.Neuberger@sncc.com]
> > > Sent: Wednesday, March 03, 2004 2:40 PM
> > > To: 'Ant Users List'
> > > Subject: RE: Sshexec fail on starting a service (websphere)
> > > 
> > > 
> > > I maybe figured out why its still hanging.  When the 
> > > websphered script is
> > > called it invokes serverStart.sh then it invokes actual java 
> > > process.  This
> > > process never dies, because the server is now running.
> > > 
> > > but for some reason sshexec /or jsch is not noticing that the 
> > > service is
> > > started...aka  [ OK ] from the websphered script.
> > > 
> > > Maybe its an issue with sshexec or probably jsch.
> > > http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tool
> > > s/ant/taskdefs
> > > /optional/ssh/SSHExec.java?rev=1.14&view=auto
> > > The code SSHExec waits until it gets an EOF from the channel.
> > >  while (!channel.isEOF()) {
> > > 
> > > It sure would be nice to based on the output what is 
> > recieved from the
> > > channel, to determine from their if it failed or not.
> > > 
> > > Ie....  >   [sshexec] Shutting down websphered: 
> > > >   [sshexec] [  OK  ]
> > > 
> > > This <websphered> script is called on boot of the server.  It 
> > > works fine
> > > outside of ant / wsad
> > > 
> > > Would this be a good suggestion for the SSHExec task?  I can 
> > > write the code,
> > > if necessary.  It doesn't look to complicated.
> > > 
> > > Thoughts....from ANT developers.
> > > 
> > > Thanks again.
> > > 
> > > Nick Neuberger
> > > 
> > > 
> > > -----Original Message-----
> > > From: Anderson, Rob (Global Trade) [mailto:Rob.Anderson@nike.com]
> > > Sent: Wednesday, March 03, 2004 3:22 PM
> > > To: Ant Users List
> > > Subject: RE: Sshexec fail on starting a service (websphere)
> > > 
> > > 
> > > Depending on what is running in your WebSphere environment, 
> > > it may take a
> > > really long time to start. Try timing how long it takes to 
> > > start up and then
> > > adjust your timeout attribute accordingly. Time it from remote...
> > > 
> > > time ssh user@host "/etc/init.d/websphere start"
> > > 
> > > Another option is to background the start command, but then 
> > > ant will exit
> > > successfully whether or not websphere starts successfully.
> > > 
> > > -Rob Anderson
> > > 
> > > > -----Original Message-----
> > > > From: Nick Neuberger [mailto:Nick.Neuberger@sncc.com]
> > > > Sent: Wednesday, March 03, 2004 10:01 AM
> > > > To: user@ant.apache.org
> > > > Subject: Sshexec fail on starting a service (websphere)
> > > > 
> > > > 
> > > > I'm trying to call start a service and the service actually 
> > > > starts but ant
> > > > always fails on timeout from the task.  Other services are 
> > > > working fine such
> > > > as ibmhttpd service.
> > > > 
> > > > I'm running ANT Build script on win2k and server is 
> redhat linux.
> > > > 
> > > > Any thoughts?  I think it might have something to do with the 
> > > > websphered
> > > > script in /etc/rc.d/init.d/
> > > > 
> > > > Snippet of output.
> > > > 
> > > > stopServiceWebSphered:
> > > >      [echo] ****** Stopping WebSphereD Service... ******
> > > >   [sshexec] Connecting to machine1:22
> > > >   [sshexec] Shutting down websphered: 
> > > >   [sshexec] [  OK  ]
> > > > 
> > > > startServiceWebSphered:
> > > >      [echo] ****** Starting WebSphereD Service... ******
> > > >   [sshexec] Connecting to machine1:22
> > > >   [sshexec] Starting websphered: 
> > > >   [sshexec] [  OK  ]
> > > > 
> > > > BUILD FAILED
> > > > C:\workspace\v5.1\imsii\sncc-ims-build\deploy.xml:50: 
> > > Following error
> > > > occured while executing this line
> > > > C:\workspace\v5.1\imsii\sncc-ims-build\deploy.xml:79: 
> > Timeout period
> > > > exceeded, connection dropped.
> > > > 
> > > > Total time: 6 minutes 35 seconds
> > > > 
> > > > Snipped of ANT script.
> > > > 
> > > > 	<target name="stopServiceHttpServer">
> > > > 		<echo message="****** Stopping Service 
> Http Server...
> > > > ******"/>		
> > > > 		<sshexec trust="true" timeout="15000"
> > > > host="${targetMachine}" username="${user.id}" 
> > password="${password}"
> > > > command="sudo /sbin/service ibmhttpd stop"/>
> > > > 	</target>
> > > > 
> > > > 	<target name="startServiceHttpServer">
> > > > 		<echo message="****** Starting Service 
> Http Server...
> > > > ******"/>
> > > > 		<sshexec trust="true" timeout="15000"
> > > > host="${targetMachine}" username="${user.id}" 
> > password="${password}"
> > > > command="sudo /sbin/service ibmhttpd start"/>
> > > > 	</target>
> > > > 
> > > > 	<target name="stopServiceWebSphered">
> > > > 		<echo message="****** Stopping 
> WebSphereD Service...
> > > > ******"/>
> > > > 		<sshexec trust="true" timeout="240000"
> > > > host="${targetMachine}" username="${user.id}" 
> > password="${password}"
> > > > command="service websphered stop"/>
> > > > 	</target>
> > > > 
> > > > 	<target name="startServiceWebSphered">
> > > > 		<echo message="****** Starting 
> WebSphereD Service...
> > > > ******"/>
> > > > 		<sshexec trust="true" timeout="320000"
> > > > host="${targetMachine}" username="${user.id}" 
> > password="${password}"
> > > > command="service websphered start"/>
> > > > 	</target>
> > > > 
> > > > 
> > > > Thanks ahead..
> > > > 
> > > > Nick
> > > > 
> > > > 
> > > > - - - - - - 
> > > > This e-mail message is intended only for the use of the 
> > > > individual or entity
> > > > identified in the alias address of this message and may 
> > > > contain confidential
> > > > and privileged information. Any unauthorized review, use, 
> > > > disclosure or
> > > > distribution of this e-mail message is strictly prohibited. 
> > > > If you have
> > > > received this e-mail message in error, please notify the 
> > > > sender immediately
> > > > by reply e-mail and delete this message from your system. 
> > Thank you.
> > > > 
> > > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > > For additional commands, e-mail: user-help@ant.apache.org
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > > 
> > > 
> > > - - - - - - 
> > > This e-mail message is intended only for the use of the 
> > > individual or entity
> > > identified in the alias address of this message and may 
> > > contain confidential
> > > and privileged information. Any unauthorized review, use, 
> > > disclosure or
> > > distribution of this e-mail message is strictly prohibited. 
> > > If you have
> > > received this e-mail message in error, please notify the 
> > > sender immediately
> > > by reply e-mail and delete this message from your system. 
> Thank you.
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > > 
> > > 
> > > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> > 
> > - - - - - - 
> > This e-mail message is intended only for the use of the 
> > individual or entity
> > identified in the alias address of this message and may 
> > contain confidential
> > and privileged information. Any unauthorized review, use, 
> > disclosure or
> > distribution of this e-mail message is strictly prohibited. 
> > If you have
> > received this e-mail message in error, please notify the 
> > sender immediately
> > by reply e-mail and delete this message from your system. Thank you.
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> - - - - - - 
> This e-mail message is intended only for the use of the 
> individual or entity
> identified in the alias address of this message and may 
> contain confidential
> and privileged information. Any unauthorized review, use, 
> disclosure or
> distribution of this e-mail message is strictly prohibited. 
> If you have
> received this e-mail message in error, please notify the 
> sender immediately
> by reply e-mail and delete this message from your system. Thank you.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


- - - - - - 
This e-mail message is intended only for the use of the individual or entity
identified in the alias address of this message and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution of this e-mail message is strictly prohibited. If you have
received this e-mail message in error, please notify the sender immediately
by reply e-mail and delete this message from your system. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message