Auto turn off wifi when cable connected

Script ini akan mematikan wifi secara otomatis, saat koneksi menggunakan kabel (ethernet) aktif. Saat kabel disconnect, wifi akan aktif kembali.

Buat file
/etc/NetworkManager/dispatcher.d/99khad:



#!/bin/sh

myname=$(basename "$0") || exit 1
log() { logger -p user.info -t "${myname}[$$]" "$*"; }

IFACE=$1
ACTION=$2

case ${IFACE} in
    eth0)
        case ${ACTION} in
            up)
nmcli nm wifi off
                ;;
            down)
nmcli nm wifi on
                ;;
        esac
        ;;
    wlan0)
        case ${ACTION} in
            up)
                ;;
            down)
                ;;
        esac
        ;;

esac


jangan lupa chmod 755


Comments

Popular posts from this blog

Optimize SSD on Linux

Manually clean up zimbra zmcat/zmcpustat exploit

Ports to allow for whatsapp call