daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '''
  2. Created on Sep 28, 2011
  3. '''
  4. import time,struct,socket,os
  5. from subprocess import Popen,call
  6.  
  7. inf = [(36967,"cs2d_dedicated1","/home/cs2d/cs2d_dedicated1"),(36964,"cs2d_dedicated2","/home/cs2d_2/cs2d_dedicated2")]
  8. ip = '127.0.0.1'
  9.  
  10.  
  11. if __name__ == "__main__":
  12.     request_info = struct.pack('<9B',1,0,3,0x8D,0xA2,0xFB,0x01,0x73,0x00) # this is for getting server information
  13.     s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
  14.     s.settimeout(5) # if server doesnt respond after 5 secs, timeout
  15.     while True:        
  16.         print "checking"
  17.         for i in inf:
  18.             port = i[0]
  19.             s.sendto(request_info,(ip,port))
  20.             try:
  21.                 s.recvfrom(128)
  22.                 print str(port) + " online!"
  23.             except socket.timeout:
  24.                 print str(port) + " not online!"
  25.                 Popen(["/usr/bin/killall",i[1]],shell = False)                
  26.                 Popen(["/usr/bin/screen","-D","-m",i[2]],shell=False)
  27.         time.sleep(60)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top