logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Basic webserver for alive check (Read 642 times)
medor
Full Member
***
Offline


Oldunreal member

Posts: 245
Joined: May 17th, 2009
Re: Basic webserver for alive check
Reply #15 - Jun 23rd, 2017 at 8:29pm
Print Post  
  
Back to top
 
IP Logged
 
x21-(DOG)-
Betatester
Offline


-(DOG)-

Posts: 38
Joined: Mar 30th, 2017
Gender: Male
Re: Basic webserver for alive check
Reply #16 - Jun 23rd, 2017 at 8:38pm
Print Post  
BobIsUnreal wrote on May 23rd, 2017 at 2:38am:
Python script. Meant to work only on linux.

Code
Select All
#!/usr/bin/env python

import socket
import time
import psutil #sudo apt-get install python-psutil

PROCNAME = "UCCLinux.bin"
IP = "127.0.0.1"

PORT = 1888


sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.settimeout(30)
sock.bind((IP,PORT-1))

counter = 0

while True:
        sock.sendto(":|",(IP,PORT))
        try:
                data, addr = sock.recvfrom(1024)
                counter = 0
                time.sleep(1)
        except socket.timeout:
                counter = counter + 1
                print "Counter = " + str(counter)
                if counter >= 10:
                        print "Ok attempting to kill..."
                        for proc in psutil.process_iter():
                                if proc.name( == PROCNAME:
                                        print proc.name( + "getting killed!!!"
                                        proc.kill()
                        counter = 0 




I was thinking of doing something like this using win32serviceutil in Windows and this tool called nssm that allows ucc to run as a windows service.

https://nssm.cc/

=================================================

medor wrote on Jun 23rd, 2017 at 8:29pm:


These are all linux scripts except for the telnet server.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo