Advertisement
Guest User

simple MN alert

a guest
Jan 23rd, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import os, sys, time, subprocess, threading, pygame
  4.  
  5. def check():
  6.     # 1800 secs = 30 mins, adjust to suit
  7.     mythread = threading.Timer(1800.0, check)  
  8.    
  9.     mythread.start()
  10.     now = time.strftime("%c")
  11.     print '\n' + now
  12.  
  13.     m = 'mnIPlist.txt'             
  14.     # stick your IPs in a file called mnIPlist.txt in the same directory as this script
  15.     #eg
  16.     #123.234.345.4
  17.     #123.234.345.5
  18.     #123.234.345.6
  19.  
  20.     # path to darkcoind
  21.     p = '/home/stu/.darkcoin/darkcoind'
  22.  
  23.     with open(m, mode="r") as f:
  24.         a = [line.strip() for line in f]
  25.         for line in a:
  26.             try:
  27.                 r = subprocess.check_output(p + ' masternode list | grep ' + line, shell=True)                     
  28.                 if r[-3] is '1':
  29.                         print 'MN ' + line + ' is OK!'
  30.                 except:
  31.                     print 'MN ' + line + ' is NOT OK!'
  32.                     pygame.mixer.init()
  33.                 pygame.mixer.music.load("my-masternode-is-b0rked.mp3") 
  34.                 pygame.mixer.music.play()
  35.                 while pygame.mixer.music.get_busy() == True:
  36.                         continue
  37.                     mythread._Thread__stop()
  38.                     sys.exit()
  39.                    
  40. check()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement