Advertisement
0x3c0

Untitled

May 29th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import subprocess,time,pynotify
  4.  
  5. while True:
  6.     a=subprocess.Popen(['ping','-c','1','192.168.1.254'],stdout=subprocess.PIPE).communicate()[0].splitlines()
  7.     if len(a)==0 or a[-1]=='':
  8.         n=pynotify.Notification('ping','failed')
  9.         n.set_timeout(2000)
  10.         n.show()
  11.         time.sleep(40)
  12.     else:
  13.         time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement