wlan / wifi reset without reboot [not a question]
asked 2014-02-05 23:23:43 +0200
This post is a wiki. Anyone with karma >75 is welcome to improve it.
I have an icon "wlan reset" setup as following:
a file /usr/share/applications/wlan-reset.desktop containing:
[Desktop Entry]
Type=Application
Name=wlan reset
Exec=sh -c "exec /path/program"
Icon=icon-launcher-mad-developer
as devel-su created a script
#!/bin/sh
rmmod wlan
sleep 20
modprobe wlan
script with setuid bit:
chmod 4755 <script>
c code from setuid on shell scripts
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "/path/script" );
return 0;
}
compile the program:
gcc <c code> -o <program>
program with setuid bit:
chmod 4755 <program>
et voila a wlan / wifi reset without rebooting
Both with the icon and the commandline is that wlan status icons most of the time does not get updated.
nice, thank you!
Low ( 2014-02-06 01:07:42 +0200 )editExcellent, thank you very much!
IZ1IVA ( 2014-02-06 22:25:09 +0200 )editThank you! I needed this. Now I see there is an app based on this solution on OpenRepos: Wlan reset
cocof2001 ( 2014-02-07 15:20:16 +0200 )editThanks! Shouldn't it use "modprobe -r" instead of rmmod? "man rmmod" says so.
etam ( 2014-02-16 12:14:58 +0200 )edit