linux ping check
-
Linux Ping (ICMP) check bash Shell ScriptingLinux/Shell Script 2019. 4. 17. 09:49
리눅스의 bash셀을 이용한 ping check 스크립트 - pinglist.txt : ping check iplist - pingcheck.sh : ping shell script pinglist.txt 127.0.0.1 # Loopback (Test) 192.168.x.77 # 정상응답 서버 (Green) 192.168.x.78 # Shutdown 된 서버 (Red) pingcheck.sh #!/bin/bash for i in `cat pinglist.txt`; do ping -c1 $i > /dev/null 2>&1 if [ $? -eq 0 ];then echo $i 'ping check ok' else echo $i 'ping check fail' fi done pingcheck.sh 127.0...
-
[Python] linux ping check(ICMP) programPython/Python for Linux 2019. 4. 9. 13:40
#!/usr/bin/python # Python Version : 2.7.5 from os import system from datetime import datetime checkList = ('127.0.0.1','192.168.x.99','192.168.x.98') logTime = str(datetime.today())[:19] for host in checkList: cmdstring = 'ping -c1 '+host+' 1>/dev/null' # Linux Ping Check Command var = system(cmdstring) if var == 0: # value = 0, OK print host, 'ping ok : ', logTime else: print host, 'ping fail ..