Command to stop the grid

3,591 views
Skip to first unread message

Naresh

unread,
Jun 21, 2012, 5:10:05 AM6/21/12
to webd...@googlegroups.com
Hello all,

As we have command to start the grid and nodes, can we stop grid and nodes using commands?

Or can we stop the grid using programming?

Thanks,
Naresh

Krishnan Mahadevan

unread,
Jun 21, 2012, 6:07:08 AM6/21/12
to webd...@googlegroups.com

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Thu, Jun 21, 2012 at 2:40 PM, Naresh <naresh...@gmail.com> wrote:
Hello all,

As we have command to start the grid and nodes, can we stop grid and nodes using commands?
I am not aware of any such command (Blame it on my ignorance perhaps)
 

Or can we stop the grid using programming?

Yes you can provided you spawned a grid locally via your code.
 

Thanks,
Naresh

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/Z4nEIG-ynT0J.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Mike Riley

unread,
Jun 21, 2012, 12:58:33 PM6/21/12
to webd...@googlegroups.com
On Windows I don't know of one, but there is probably something (other than using Ctrl-Alt-Del and choosing the task manager button).  On *NIX systems kill -9 should work just fine.

Mike

darrell

unread,
Jun 22, 2012, 2:23:51 PM6/22/12
to webdriver
How are you starting the grid and nodes? On my system I have MSDOS
command scripts which start up the grid and nodes. I then have MSDOS
windows open. To stop command line executables, gracefully, you can
send a kill signal to the command using taskkill. There is a /F option
for taskkill which will just dump the process from memory. It is much
like the kill -9 of UNIX/Linux. This should be a last resort however.
A simple taskkill, without /F, should gracefully shutdown the process.
Enter taskkill /? in a command prompt for more details.

If you are on a UNIX/Linux system you should be able to stop shell
scripts using kill. Should work the same as taskkill on Windows.

Darrell

darrell

unread,
Jun 22, 2012, 2:26:13 PM6/22/12
to webdriver
Ouch. Do you kill -9 everything on UNIX? I hope you try just a plain
kill before you jump right at kill -9. Kill is like turning off the
ignition in a car. Kill -9 is like popping the hood and disconnecting
the distributor cap. Kill is used all the time. Kill -9 should be a
last resort.

Mike Riley

unread,
Jun 22, 2012, 4:42:53 PM6/22/12
to webd...@googlegroups.com
I didn't say it was recommended...  ;)

You could also send a signal that would have it gracefully shutdown.

My point was that there are lots of ways and the question was to general to give a specific answer.

In my Windows system I am using Task Manager and it recycles the server twice every day by terminating the task after N hours.  I am sure it does that by some Windows equivalent of kill.   I found recycling them for the evening test runs and then for the daily work on writing new tests greatly reduced the random failures, which I attributed to memory leaks or other such issues in the servers (it is more stable now, but still not stable enough to run unattended for weeks at a time).

Mike

Naresh Thandu

unread,
Jun 23, 2012, 7:00:12 AM6/23/12
to webd...@googlegroups.com
Hello all,

I am using Windows. I use batch files to start the grid. And as of now I am using PsExec to execute batch files on remote machines.

But somehow I am not convinced with using PsExec. One reason is we have to give username and password(plain text) in the code itself. And everything runs in the console.

So I thought of writing a window service and hosting the window service on my grid machine and node machines. Window service will execute batch file and start the grid and nodes. I am able to start the grid and nodes using batch files. I thought of using same concept for stopping the them also. But I am not aware of command to stop the grid and nodes.

And after that I thought of stopping the process. But all the nodes run under Java process only. So can not differentiate which node is running under which process.

As Mike said manually restarting and stopping the nodes could be avoided using this approach. Window service will start at a particular time on each day and stop after 
running the test cases.

Thanks,
Naresh

darrell

unread,
Jun 23, 2012, 11:10:54 AM6/23/12
to webdriver
If you look at the man page for kill you'll see that it is really just
sending a signal to the process specified. You can send a signal by
name or by number. Each implementation of UNIX (AIX, HPUX, Solaris,
Darwin, etc.) has differences but they all support kill -9 or kill -s
KILL. Other options for kill are HUP, INT, QUIT, ABRT ans TERM. You
can also signal the process with things like Float Point Error (kill -
s SIGFPE), Illegal Instruction (kill -s SIGILL) or Bus Error (kill -s
SIGBUS) on some systems. I just see a lot of people use nothing but
kill -9. The kill command is much more powerful than that plus on
Enterprise systems, with a lot of state information remaining in
memory, doing a kill -9 can easily corrupt the system.

If your suspect your server is memory leaking or needs to be stopped
and started every so often have a look at TASKLIST and TASKKILL.
TASKLIST will give you the process id of the task you want to stop and
a simple TASKKILL /pid {process_id} will stop the task gracefully. You
can then use TASKLIST to confirm the task stopped. If it does not stop
you can use TASKKILL /F to forcefully kill it.

Another option is to use Task Scheduler to stop and start the server.
You can create a task in Task Scheduler which will kill the task
before starting it again. The first time the task starts it just runs
the server. Next time it tries to start it kills the current server
and starts a new one.

Darrell

darrell

unread,
Jun 23, 2012, 11:18:34 AM6/23/12
to webdriver
PsExec is just syntactic sugar. By that I mean it is calling the exact
same calls that something like runas.exe, taskkill.exe and
tasklist.exe use. The PsExec commands are more UNIX style so people
used to UNIX will find the syntax of PsExec easier to understand.
However, the built-in Windows commands (like taskkill.exe) allow you
to use Windows authentication. Look into use Windows authentication
with the built-in Windows commands. If you are logged into the domain
on your local computer and you have a domain account on the remote
computer you should be able to set it up such that having validated
the user on your local computer (by being logged in) you can run
commands on the remote computer without being asked for a password. It
is sort of like using ssh keys on UNIX systems but a little more
complicated (security through obscurity).

Even if you have the local computer running the remote commands via
task scheduler, when you are not logged in locally, you can have task
scheduler save the credentials and still not require a password.

Darrell

Alexei Barantsev

unread,
Jun 23, 2012, 2:38:04 PM6/23/12
to webd...@googlegroups.com
Hi,

You can stop the nodes and the hub using http requests.


Regards,
-- 
Alexei Barantsev
Software-Testing.Ru

Naresh

unread,
Jun 25, 2012, 4:19:21 AM6/25/12
to webd...@googlegroups.com
Hello Alexei,

I tried of using both the commands. But unfortunately both of them not working.

As both are http commands, I tried of opening them in a browser. Please correct me if I am doing anything wrong.

Thanks,
Naresh

darrell

unread,
Jun 25, 2012, 9:03:30 AM6/25/12
to webdriver
Naresh,

These should work for you. If you start the hub using:

java -Xmx1024m -Xms512m -jar selenium-server-standalone.jar -role
hub -port 4444 -maxInstances 1

then you should be able to shut down the hub using:

http://localhost:4444/lifecycle-manager?action-shutdown

I have not used this command before so I cannot confirm it works. I
know from the source code it will attempt to shutdown the hub 8 times
then give up. If you started a node using:

java -Xmx1024m -Xms512m -jar selenium-server-standalone.jar -role
rc -hubPort 5555 -hubHost localhost
-maxSessions 1 -port 5555 -browser
browserName=firefox,version=10,platform=WINDOWS,javascriptEnabled=true

then you should have a Firefox 10 node running on a Windows system
with Javascript enabled. To shut this down use:

http://localhost:5555/selenium-server/driver/?cmd=shutDownSeleniumServer

I have use the cmd=shutDownSeleniumServer command and it works great.
This assumes everything is done on the localhost. If you run the java
commands on remote machines then you can change 'localhost' to the IP
address of the remote machine.

Darrell

Simon Stewart

unread,
Jun 27, 2012, 2:56:55 AM6/27/12
to webd...@googlegroups.com
You may need to update the version of Grid you're using if it's an old one :)

Simon
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.

Naresh Thandu

unread,
Jun 27, 2012, 6:32:00 AM6/27/12
to webd...@googlegroups.com
Hello Simon,

I am using 2.23.1.

I have not yet tried Darrell's input. I will update the thread after trying that one.

Thanks,
Naresh.
--
Regards,
Naresh Thandu,
+91-9916710222

Mike Riley

unread,
Jan 14, 2013, 5:29:22 PM1/14/13
to webd...@googlegroups.com
Please start a new thread rather than hijacking an old one.  This is a slightly different question than the original one, too.

Mike

On Saturday, January 12, 2013 9:02:19 AM UTC-8, Muhammad wrote:
Hi all,

is there a documentation about the commands I can use via HTTP?

Thanks!

Muhammad

unread,
Jan 14, 2013, 5:32:18 PM1/14/13
to webd...@googlegroups.com
Mike, you are right, I am sorry!
Reply all
Reply to author
Forward
0 new messages