Hey
Ich wollt ma eben euer 4Story ServerAdmin Leben einfacher machen und hab ein kleines programm geschrieben, das die services (wenn nötig) mit einem button stoppt und sie wieder startet.
screen:
[Only registered and activated users can see links. Click Here To Register...]
Source (Könnt ihr wenn ihr wollt selbst compilen, ich hab nix dagegen):
VT: [Only registered and activated users can see links. Click Here To Register...]
1/47 : virenscanner können auch mal irren :)
Kleine anmerkung am rande: Nicht schnell hintereinander den button drücken, sonst kommen viele errors raus ;)
Ich wollt ma eben euer 4Story ServerAdmin Leben einfacher machen und hab ein kleines programm geschrieben, das die services (wenn nötig) mit einem button stoppt und sie wieder startet.
screen:
[Only registered and activated users can see links. Click Here To Register...]
Source (Könnt ihr wenn ihr wollt selbst compilen, ich hab nix dagegen):
Code:
Imports System.IO
Imports System.ServiceProcess
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub start()
Label1.Text = "Services werden Gestartet"
ProgressBar1.Value = "50"
Try
Dim sc As New ServiceController("TCTRL_GSP")
sc.Start()
Catch
MsgBox("Error!!" + vbNewLine + "TCTRL_GSP Konnte nicht Gestatet werden.", MsgBoxStyle.Critical, "Error!")
End Try
ProgressBar1.Value = "58,33333"
Try
Dim sc As New ServiceController("TLOGIN_GSP")
sc.Start()
Catch
MsgBox("Error!!" + vbNewLine + "TLOGIN_GSP Konnte nicht Gestatet werden.", MsgBoxStyle.Critical, "Error!")
End Try
ProgressBar1.Value = "66,666666666"
Try
Dim sc As New ServiceController("TWORLD_GSP")
sc.Start()
Catch
MsgBox("Error!!" + vbNewLine + "TWORLD_GSP Konnte nicht Gestatet werden.", MsgBoxStyle.Critical, "Error!")
End Try
ProgressBar1.Value = "75"
Try
Dim sc As New ServiceController("TRELAY_GSP")
sc.Start()
Catch
MsgBox("Error!!" + vbNewLine + "TRELAY_GSP Konnte nicht Gestatet werden.", MsgBoxStyle.Critical, "Error!")
End Try
ProgressBar1.Value = "83,33333"
Try
Dim sc As New ServiceController("TMAP_GSP")
sc.Start()
Catch
MsgBox("Error!!" + vbNewLine + "TMAP_GSP Konnte nicht Gestatet werden.", MsgBoxStyle.Critical, "Error!")
End Try
ProgressBar1.Value = "91,666666633333"
'Try
'Dim sc As New ServiceController("TLOG0")
'sc.Start()
'Catch
'MsgBox("Error!!" + vbNewLine + "TLOG0 Konnte nicht Gestatet werden.", MsgBoxStyle.Critical, "Error!")
'End Try
ProgressBar1.Value = "100"
Label1.Text = "Fertig"
End Sub
Private Sub stops()
Label1.Text = "Services werden Gestoppt"
Try
Dim sc As New ServiceController("TCTRL_GSP")
sc.Stop()
Catch
End Try
Try
Dim sc As New ServiceController("TLOGIN_GSP")
sc.Stop()
Catch
End Try
Try
Dim sc As New ServiceController("TWORLD_GSP")
sc.Stop()
Catch
End Try
Try
Dim sc As New ServiceController("TRELAY_GSP")
sc.Stop()
Catch
End Try
Try
Dim sc As New ServiceController("TMAP_GSP")
sc.Stop()
Catch
End Try
Try
Dim sc As New ServiceController("TLOG0")
sc.Stop()
Catch
End Try
ProgressBar1.Value = "25"
Timer1.Start()
If checkserviceon() = True Then
Label1.Text = "Services on, press button..."
ElseIf checkserviceon() = False Then
Label1.Text = "Services off, starting..."
start()
End If
End Sub
Dim stcheck As Boolean = False
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Control.CheckForIllegalCrossThreadCalls = False
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Call stops()
End Sub
Function checkserviceon()
If stcheck = False Then
Dim count As Integer
Dim Wait As String = ""
Dim TCTRL_GSP As New ServiceController("TCTRL_GSP")
Dim TLOGIN_GSP As New ServiceController("TLOGIN_GSP")
Dim TWORLD_GSP As New ServiceController("TWORLD_GSP")
Dim TRELAY_GSP As New ServiceController("TRELAY_GSP")
Dim TMAP_GSP As New ServiceController("TMAP_GSP")
If TCTRL_GSP.Status = ServiceControllerStatus.Running Then
count = count + 1
Wait &= "TCTRL,"
Else
End If
If TLOGIN_GSP.Status = ServiceControllerStatus.Running Then
count = count + 1
Wait &= "TLOGIN_GSP,"
Else
End If
If TWORLD_GSP.Status = ServiceControllerStatus.Running Then
count = count + 1
Wait &= "TWORLD_GSP,"
Else
End If
If TRELAY_GSP.Status = ServiceControllerStatus.Running Then
count = count + 1
Wait &= "TRELAY_GSP,"
Else
End If
If TMAP_GSP.Status = ServiceControllerStatus.Running Then
count = count + 1
Wait &= "TMAP_GSP,"
Else
End If
If count >= "1" Then
Label1.Text = "Waiting For " + count + " to close:" + vbNewLine + Wait
Return True
Else
stcheck = True
Label1.Text = "services stopped!"
Return False
End If
ElseIf stcheck = True Then
Label1.Text = "services stopped!"
Return False
End If
End Function
End Class
VT: [Only registered and activated users can see links. Click Here To Register...]
1/47 : virenscanner können auch mal irren :)
Kleine anmerkung am rande: Nicht schnell hintereinander den button drücken, sonst kommen viele errors raus ;)