Portfolio/Python

python ping test code

시작의 의미 2020. 10. 28. 20:50

테스트 당시 물리서버 alive 체크를 하기 위해 사용했었음

from os import system

def pingtest(ip) :
	check = 0
    
    cmd='ping -c 1' + ip
    check = system(cmd)
    if(check == 0) :
    	// Seccess ping test
    	print("---")
        pass
        
	else :
    	// Fail ping test
        print("---")
        pass
        
if __name__ == '__main__':
	pingtest('xxx.xxx.xxx.xxx')
    

'Portfolio > Python' 카테고리의 다른 글

Threading  (0) 2020.02.14
Python Error 모음 : iteration over non-sequence  (0) 2020.02.10