sh StayOnWIFI_cnetwormanager_NetworkManager_reconnect.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh StayOnWIFI_cnetwormanager_NetworkManager_reconnect.sh相关的知识,希望对你有一定的参考价值。

## stayOnline2.sh ##
#!/bin/sh

CONNECT_STR="-C $1 --unprotected"

sudo ifconfig wlan0 down
sudo killall nm-applet
sudo killall cnetworkmanager

sudo rmmod b43 ssb mac80211 cfg80211 wl ; sudo modprobe b43

sleep 5;
sudo ifconfig wlan0 down
#sudo macchanger --random wlan0

sudo iwconfig wlan0 retry 3
sudo iwconfig wlan0 txpower 20
#sudo iwconfig wlan0 rts 2346
#sudo iwconfig wlan0 frag 256  

sudo ifconfig wlan0 up

cd /home/epcim/hg2g/apps/cnetworkmanager-0.21.1
#while true; do if [ "DISCONNECTED" = `./cnetworkmanager --state` ]; then sudo killall cnetworkmanager 2>/dev/null > /dev/null ; sudo ./cnetworkmanager $CONNECT_STR & else ./cnetworkmanager --state ;fi; sleep 5; done
while true; do if [ "DISCONNECTED" = `./cnetworkmanager --state` ]; then sudo killall cnetworkmanager 2>/dev/null > /dev/null ; sudo ./cnetworkmanager $CONNECT_STR & fi; sleep 5; done

-----------------------------





## stayOnline3.sh ##
#!/bin/sh

CONNECT_STR="-C \"$1\" --unprotected"
NEW_MAC="$2"

sudo ifconfig wlan0 down
sudo killall nm-applet
sudo killall cnetworkmanager

sudo ifconfig wlan0 down
sudo rmmod b43 ssb mac80211 cfg80211 wl ; sudo modprobe b43

sleep 5;
sudo ifconfig wlan0 down
sudo macchanger $NEW_MAC wlan0
#sudo macchanger --random wlan0

sudo iwconfig wlan0 retry 3
sudo iwconfig wlan0 txpower 20
#sudo iwconfig wlan0 rts 2346
#sudo iwconfig wlan0 frag 256  

sudo ifconfig wlan0 up

cd /home/epcim/hg2g/apps/cnetworkmanager-0.21.1
#echo "DEBUG:CONSTR: xxx$CONNECT_STR xxx"
#while true; do if [ "DISCONNECTED" = `./cnetworkmanager --state` ]; then sudo killall cnetworkmanager 2>/dev/null > /dev/null ; sudo ./cnetworkmanager $CONNECT_STR & else ./cnetworkmanager --state ;fi; sleep 5; done
while true; do if [ "DISCONNECTED" = `./cnetworkmanager --state` ]; then sudo killall cnetworkmanager 2>/dev/null > /dev/null ; sudo ./cnetworkmanager $CONNECT_STR & fi; sleep 5; done

-----------------------------





## stayOnline4.sh ##
#!/bin/sh

if test $# = 0; then
  echo "Usage: $@ 'ESSID' '<NEW_MAC>'"
  exit
fi;

CONNSTR="-C \"$1\" --unprotected"
NEW_MAC="$2"
WIFCARD=wlan0

echo "
## DO BY HAND FIRST
-------------
sudo ifconfig $WIFCARD down
sudo killall nm-applet
sudo killall cnetworkmanager
sudo rmmod b43 ssb mac80211 cfg80211 wl ; sudo modprobe b43
-------------
"


## NEW MAC & SETTINGS
sleep 3;
sudo killall cnetworkmanager
if test $# = 2; then
  sudo ifconfig $WIFCARD down
  if [ "$2" = "random" ] ; then
    sudo macchanger --random $WIFCARD;
  else
    sudo macchanger -m "$NEW_MAC" $WIFCARD;
  fi;
fi;
sudo iwconfig $WIFCARD retry 3
sudo iwconfig $WIFCARD txpower 20
#sudo iwconfig $WIFCARD rts 2346
sudo iwconfig $WIFCARD frag 256  
sudo ifconfig $WIFCARD up

cd /home/epcim/hg2g/apps/cnetworkmanager-0.21.1
while true; do 
  if [ "DISCONNECTED" = `./cnetworkmanager --state` ]; 
  then 
    sudo killall cnetworkmanager 2>/dev/null > /dev/null ; 
    sudo ./cnetworkmanager $CONNSTR & 
  fi; sleep 5; 
done

-----------------------------





以上是关于sh StayOnWIFI_cnetwormanager_NetworkManager_reconnect.sh的主要内容,如果未能解决你的问题,请参考以下文章

sh sh_template.sh

sh sh.sh

Linux下面如何运行 SH文件

配置告警系统主脚本main.sh mon.sh load.sh 502.sh disk.sh

shell 脚本各种执行方式(source ./*.sh, . ./*.sh, ./*.sh)的区别

linux下sh文件的运行