News:

Huge spam cleanup. I hope, everything important is still in place. :-)

Main Menu

Scriptbased shutdown via telnet or similar possible?

Started by Sirius, March 23, 2009, 12:57:21 PM

Previous topic - Next topic

Sirius

I'm looking for a solution to shut down CentrED via a self programmed webinterface. Is there any way to connect via telnet or something similar to CentrED and shut it down "softly"? I don't want to kill the process via commandline commands (I don't know if this can cause errors in the MUL-files if a user is currently working on them).
Or does anybody know another solution for a scriptbased shutdown?

Thanks in advance,
Sirius

Hitman

Shutting it down via commandline should be perfectly fine. I catch ctrl+c (which should be SIGTERM on *nix) and perform a clean shutdown then. So a kill -15 or killall -15 should do the trick.

Tare

Didnt the CentrED-client has the option to shutdown the CedServer, loged in as admin? In this way you can see if someone ist working, tell him to log out for a while and shutdown the server then.

Hitman

Indeed, but then you would have to implement to protocol to communicate with the server (which is also possible ofcourse). But on the other hand: is it really that bad if a user gets kicked out during work? Every large building requires several hours, so giving someone some more seconds or even minutes to finish wouldn't cut it anyway ;)

Tare

Well depends on the case, for example a Large Scale Command shouldnt be interrupt, or is there a controll so that the command can work till end and then the CedServer shuts down?

Hitman

I'm not sure. But since LSC can only be started by admins, that shouldn't cause trouble. Admins should be able to speak with each other ;-)
But of course you can simply test what happens if you press ctrl+c while a LSC is being processed.

Sirius

ok, thanks. I will try this out via automatic ssh connection and kill command.

Do you have any idea how to perform this on windows automaticaly from remote?

Hitman

Automating Windows in that regard is always a bit tricky. I would say the "easiest" thing for now is, to find the window and send ctrl+c. This could for example be done via AutoIt and a script using WinActivate and Send. Or you write a little program using FindWindow and PostMessage/SendKeys/whatever.