 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
tharpm
Joined: 12 May 2010 Posts: 18 Country: United States |
|
Restarting 24x7 Service |
|
I would like to have a job that restarts the 24x7 service on the server that can be executed from the Remote Control PC manually if needed.
The problem I have run into is that the VBS I wrote executes and the service stops on the server, but it stops the script from executing as well and now the service will not start again.
Is there a way to run the VBS so that it continues on after the 24x7 service goes down?
Is there a better way to restart the server service from the remote control PC manually?
|
|
Mon Jun 21, 2010 10:48 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7951
|
|
|
|
Create a simple DOS batch file with 2 commands
NET STOP "24x7 Scheduler"
NET START "24x7 Scheduler"
You can run this batch from a job manually or schedule it if needed.
|
|
Mon Jun 21, 2010 11:27 am |
|
 |
tharpm
Joined: 12 May 2010 Posts: 18 Country: United States |
|
|
|
Tried that. Manually running the BAT file works. Using Run Now from the Remote PC and executing Remotely stops the service on the server but doesn't start it.
Ideas?
|
|
Mon Jun 21, 2010 11:37 am |
|
 |
Greg Johnson
Joined: 20 Oct 2001 Posts: 26
|
|
Restarting 24x7 Service |
|
This is the script that we use successfully....
// Stop and restart 24X7
// Scheduled jobs running detached can cause this to not function properly.
Dim old_pid, number
Dim new_pid, number
Dim FileNum, number
ProcessGetID( "24X7.EXE", old_pid )
//Clear the default queue so this job doesn't fire over and over.
FileDeleteEx( "D:\24x7\Queue\[default]\*", FIleNum )
//stop and start 24x7
Run "24x7", "@V"24x7_home"", new_pid
ProcessKill old_pid
|
|
Wed Jun 23, 2010 8:56 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7951
|
|
|
|
I'd suggest to use JobProcessID to get id of the current process. There could be multiple instances of 24x7 running, getting process id by name may return id of another process.
|
|
Wed Jun 23, 2010 9:04 am |
|
 |
tharpm
Joined: 12 May 2010 Posts: 18 Country: United States |
|
|
|
I ended up creating a VBS file on the Remote Control PC that asks for the server name then restarts the service on the server remotely. Users then use a RunAs on the script with an account that is allowed to restart the service and it works like a champ.
Cool thing is it works on a moments notice and because it asks for the server, works on all four servers.
Here is the code:
Dim serverName, serviceName, objWMIService, servicesCollection, objService
serverName = UCase(InputBox("Enter the server you want to restart the 24x7 service on.","Enter Server"))
serviceName = " '24x7 Scheduler' "
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & serverName & "\root\cimv2")
Set servicesCollection = objWMIService.ExecQuery("Select * from Win32_Service Where Name =" & serviceName & " ")
For Each objService in servicesCollection
objService.StopService()
WSCript.Sleep 5000
objService.StartService()
Next
WScript.Echo "Service restart is completed."
WScript.Quit
|
|
Wed Jun 23, 2010 9:26 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|