Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

come resettare le impostazioni di connessione linux

  #!/bin/sh # program to check wifi and reset if not running IPTEST=192.168.1.1 iwconfig=/sbin/iwconfig rfkill=/usr/sbin/rfkill DEVICE=`$iwconfig | egrep 802 | awk ' {print $1}'` if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # Failed, try to reset wifi - sometimes works ok ( date echo "Apagando wifi...." nmcli nm wifi off sleep 3 echo Iniciando wifi.... nmcli nm wifi on sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $iwconfig ...." $iwconfig $iwconfig $DEVICE txpower off sleep 3 echo Iniciando wifi.... $iwconfig $DEVICE txpower auto fi sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $rfkill ...." $rfkill list $rfkill block wifi sleep 3 echo Iniciando wifi.... $rfkill unblock wifi fi #echo Cerrar esta ventana cuando sale el estado #sleep 3 #iftop -i $DEVICE ) >> $HOME/wificheck.log 2>&1 fi exit 0 
Source by ubuntu.yocker.com #
 
PREVIOUS NEXT
Tagged: #resettare #le #impostazioni #di #connessione #linux
ADD COMMENT
Topic
Name
3+7 =