Advertisement
rfmonk

ping.py

Jun 25th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # requires root
  3.  
  4. import subprocess
  5. import shlex
  6.  
  7.  
  8. command_line = "ping -c 3 www.altsci.com"
  9. args = shlex.split(command_line)
  10. try:
  11.     subprocess.check_call(args,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  12.     print "Alt Sci is up!"
  13.  
  14. except subprocess.CalledProcessError:
  15.     print "Failed to get ping"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement