Watcher program to make sure the service stays on.

This is the place to go if you need advice on customizing or integrating your GSP-Panel installation.
Post Reply
Mast3rShak3
Posts: 4
Joined: Fri Nov 09, 2012 5:49 pm

Watcher program to make sure the service stays on.

Post by Mast3rShak3 » Sun Nov 11, 2012 4:06 am

I made a really really simple program to make sure that the process "GSP-PanelRemote" stays running. I had a problem with high FTP loads crashing it. If you have the same problem this will solve it it does a check every second I tried at like 500ms but, It was using to many resources doing that way so... anyway here. You have to close it thought task manager the co-owner of my server company has a tendance to close everything that is open so I removed it.

Code: Select all

mports System.ServiceProcess

Public Class Form1
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If CheckIfServicelsRunning("GSP-PanelRemote") = True Then
        End If
    End Sub
    Public Function CheckIfServicelsRunning(ByVal serviceName As String) As Boolean
        Dim mySC As ServiceProcess.ServiceController
        mySC = New ServiceProcess.ServiceController(serviceName)
        If mySC.Status = ServiceProcess.ServiceControllerStatus.Stopped Then
            Label1.Text = "GSP-Panel Is NOT Running!"
            Label1.ForeColor = Color.Red
            mySC.Start()
            Return False
        ElseIf mySC.Status = ServiceProcess.ServiceControllerStatus.Running Then
            Label1.Text = "GSP-Panel Is Running!"
            Label1.ForeColor = Color.Green
            Return True
        End If


    End Function
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
        Button1.Enabled = False
        Button2.Enabled = True
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Stop()
        Button1.Enabled = True
        Button2.Enabled = False
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label1.Text = "GSP-Panel Is NOT Running!"
        Label1.ForeColor = Color.Red
    End Sub
End Class
Download link if you would rather download it. CLICK ME

Mike
Staff
Posts: 227
Joined: Fri Jun 04, 2010 10:29 pm

Re: Watcher program to make sure the service stays on.

Post by Mike » Sun Nov 11, 2012 9:23 pm

Thanks for providing this.

Our server monitor checks the backend status every 5 minutes, so if the backend or machine crashes you should receive an email.

If you are having an issue with high FTP loads then I would suggest limiting the number of users that are allowed to connect. You can do this by adding "ftpmaxconnections=10" to your gsp-panel.ini, the default value is 50 connections.

Mast3rShak3
Posts: 4
Joined: Fri Nov 09, 2012 5:49 pm

Re: Watcher program to make sure the service stays on.

Post by Mast3rShak3 » Sat Nov 17, 2012 11:16 pm

It wasn't restarting for some odd reason. The co-owner I think did the install wrong. It's a nice tool I changed it up a bit and it tracks crashes and restarts ever 15 days or if it take a % amount of ram/cpu still playing around with that.

Post Reply