"함수 is ipmiping()"의 두 판 사이의 차이

22번째 줄: 22번째 줄:
==같이 보기==
==같이 보기==
*[[함수 is_ping()]]
*[[함수 is_ping()]]
*[[ipmiping]]
*[[리눅스 ipmiping]]

2015년 4월 1일 (수) 21:15 판


1 Bash

PING_TIMEOUT=2
PING_HOST=8.8.8.8
IS_IPMIPING=`ipmiping -c1 -t$PING_TIMEOUT $PING_HOST | grep 'in time' | awk '{print $4}'`
echo $IS_IPMIPING
# 0

2 PHP

  • Linux
function is_ipmiping($host, $timeout = 2) {
	return exec("ping -c1 -t$timeout $host | grep 'in time' | awk '{print $4}'");
}

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}