//ip_conflict_check.sh
Start ========================================
#!/bin/sh
#arping -q -D -I DEVICE -c COUNT IP_ADDRESS; echo $?
#ex) arping -q -D -I eth0 -c 1 192.168.0.181; echo $?
#리턴값이 1 이면 이미 네트워크상에 IP가 존재 / 0 이면 중복 IP 없음
out="ip_check_ret.txt"
touch "$out"
arping -q -D -I eth0 -c 1 "$1"
ret=$?
echo "$ret" > "$out"
End ==========================================
실행방법
[root@afewgood /home ~]$ ./ip_conflict_check.sh 192.168.0.254
[root@afewgood /home ~]$ cat ip_check_ret.txt
1 //IP 존재함
[root@afewgood /home ~]$
'linux' 카테고리의 다른 글
crontab를 이용한 특정시간에 shellscript 실행 (0) | 2022.11.21 |
---|---|
AR을 이용한 두개의 정적 라이브러리 합치는 방법 (0) | 2022.05.30 |
특정 이름을 가진 프로세스 죽이기 (0) | 2022.04.14 |
ssh dns disable (0) | 2022.01.12 |
EmbeddedLinux 무선랜 사용 (0) | 2021.07.20 |