0

I wrote a script which is scheduled for a cron job at reboot. This script changes the wlan1 from Managed to Monitor mode.

but when I reboot the pi, this script doesn't work and writes the error message Error for wireless request "Set Mode" (8B06) : SET failed on device wlan1 ; Operation not supported

But when I power off and on, this scripts executes successfully and changes mode from Managed to Monitor.

this is my script:

#!/bin/bash
currentDate=date
echo 'Going to change the mode of wlan1 at ${currentDate}'
sudo ifconfig wlan1 down
if [[ $? -eq 0 ]]; then
    sudo iwconfig wlan1 mode monitor
    if [[ $? -eq 0 ]];then
        sudo ifconfig wlan1 up
        echo 'Wlan1 mode changed to monitor';
    else
        echo 'There is some error occurred while changing the mode';
    fi
else
    echo 'Interface could not go down';
fi

My script is scheduled is like : @reboot sudo /var/www/html/RaspiGUI/script/ModeChange-wlan1.sh

any ideas?

  • 1
    What script, what error message, what, what? – MatsK Mar 22 '18 at 5:51
  • My script is scheduled is like : @reboot sudo /var/www/html/RaspiGUI/script/ModeChange-wlan1.sh This script executes three commands sudo ifconfig wlan1 down sudo iwconfig wlan1 mode monitor sudo ifconfig wlan1 up And getting below error message: Error for wireless request "Set Mode" (8B06) : SET failed on device wlan1 ; Operation not supported. – Praveen Mar 22 '18 at 6:47
  • Please edit your question and add your comments there! And what script, please add the content! – MatsK Mar 22 '18 at 7:02
  • My script is : pi@ShopR360:~ $ sudo cat /var/www/html/RaspiGUI/script/ModeChange-wlan1.sh #!/bin/bash currentDate=date; echo 'Going to change the mode of wlan1 at ${currentDate}' sudo ifconfig wlan1 down if [[ $? -eq 0 ]];then sudo iwconfig wlan1 mode monitor if [[ $? -eq 0 ]];then sudo ifconfig wlan1 up echo 'Wlan1 mode changed to monitor'; else echo 'There is some error occurred while changing the mode'; fi else echo 'Interface could not go down'; fi – Praveen Mar 22 '18 at 7:21
  • 3
    @Praveen If you want help you're going to have to add details to your question. You're putting the details in the wrong place. Append your details here. If you will do what Matsk is asking you to do, you'll get good input and quick resolutions to your issue. – L. D. James Mar 22 '18 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.