-4

We have client side Windows server in which we frequently observe many services going DOwn,

Now Either we have to individually Login to Server and restart Service,

But I have written A Batch file which when run can automatically Restart all the services, but teh problem is I dont want to put them in Each server, tehre are 50+ server,

how to remotely connect to those serevr and execute this batch file, I have server Credential also,

Please Reply

Paul
  • 19,704
  • 14
  • 78
  • 96
RAJ
  • 123
  • 5
  • 16
  • 1
    SHOUTING WILL NOT GET A FASTER ANSWER! (But it might get you ignored.) – Andrew Thompson Jan 04 '12 at 06:57
  • If you don't want to put the batch file in to the server, how can it execute DOS commands written in that batch in that specific server? :O – Manjula Jan 04 '12 at 07:10
  • If you've got over 50 servers, you need a competent system administrator, not a way to run batch files remotely. – Paul Jan 04 '12 at 07:15
  • 1
    Not an direct answer to this, but if you have added this service as a windows service (which you can manage using Computer Management -> Service and Applications -> Services), you can set it to restart on failure by going to "Poperties" window and then "Recovery" tab. – Manjula Jan 04 '12 at 07:17
  • Read http://stackoverflow.com/questions/187836/how-do-i-restart-a-service-on-a-remote-machine-in-windows – Manjula Jan 04 '12 at 07:19

1 Answers1

2

Considered actually running your "services" as a Windows Service, so Windows will restart it automatically?

winsw - http://kenai.com/projects/winsw/pages/Home - is the one used in Glassfish for this purpose. We've used it for other Java based services too, works nicely.

Being able to run externally submitted batch files is a security disaster just waiting to happen. I would recommend against it.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • Hello My idea is to write a JAVA code which when Run will execute Batch File or the commands in the batch file into the server and run them remotely , I think ProcessBuilder() command might help but I dont know how to Use It, AND I am sorry if it seemed Like I am shouting Actually wanted to put everythn in title so it was easir to understand – RAJ Jan 04 '12 at 07:49
  • @Manjula,The idea yjhat you suggested is not working:(:(, I put the restart option for service(Apache Tomacat) for 1 minute, i stopped it manually, and it dindt restart automatically also – RAJ Jan 04 '12 at 08:05
  • @RAJ, the "and run them remotely" is the hard, insecure part which I do not think you should do that way. – Thorbjørn Ravn Andersen Jan 04 '12 at 08:49
  • ...if it is so, then is there any way, so we can create session and run this Batch file or commands using the session – RAJ Jan 04 '12 at 08:56