인터페이스가 연결되면 사용자 정의 스크립트 실행

인터페이스가 연결되면 사용자 정의 스크립트 실행

USB Wi-Fi 동글을 사용하여 인터넷에 연결합니다. 무선 연결이 끊어지면 일부 iproute 규칙도 손실됩니다.

인터페이스가 다시 연결되면 어떻게 이러한 규칙을 재설정할 수 있나요?

답변1

가지고 있는 경우 ifupdown(대부분 Debian 또는 Debian 기반 배포판을 사용하는 경우) 다음을 살펴보세요 man interfaces.

   post-up command
          Run command after bringing the interface up.  If this command fails then ifup aborts, refraining from marking the interface as  con‐
          figured  (even though it has really been configured), prints an error message, and exits with status 0.  This behavior may change in
          the future.

그래서 /etc/network/interfaces당신은 다음과 같은 것을 가질 수 있습니다

auto eth0
    iface eth0 inet dhcp
    post-up /usr/local/sbin/my-custom-script

실제 인터페이스를 위해 eth0을 바꾸십시오.

관련 정보