Ask Your Question

Executing script after wifi is on

asked 2016-09-23 18:27:40 -0500

Ttytan gravatar image

updated 2016-10-09 22:43:21 -0500

I want to run a script after I connect to a specific wifi network. First, I've tried to run it after the wifi turns on (without selecting a specific network), but I did not succeed. The script I have tried running is:

echo "I am in ifup-local"

if[[ "$1" == "wlp3s0" ]]
   echo "wlp3s0 is active"

I've named it ifup-local or ifup-pre-local and given it permissions with chmod +x. I have placed it on sbin, etc/NetworkManager/dispatcher.d and etc/network-scripts (one at a time only), but it has not worked. When I do sudo ifup wlp3s0 on the terminal to turn on wifi I expect to see the first echo but not even that happens.

I've followed these instructions: , and googled many answers on stack exchange and similar sites (didn't find anything related here). All those answers say the problem is easy, but none of them has worked for me. This makes me think the solution must be fedora specific.

Any help is much appreciated, even if it's something simple as placing it s/w else or renaming it.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-02 12:30:22 -0500

muep gravatar image

The NetworkManager man page says that

Each script receives two arguments, the first being the interface name of the device an operation just happened on, and second the action.

I think your script should check what action name gets placed to $2 instead of assuming that it is always run in response to an interface being done activating. The name of the script should have no effect apart from that scripts get run in alphabetical order.

edit flag offensive delete link more


I am terribly sorry. I missed a vital part in the description. When I type sudo ifup wlp3s0 in the terminal, I expect to see the first echo in the script, but not even that happens.

Ttytan gravatar imageTtytan ( 2016-10-09 22:41:54 -0500 )edit

Question Tools

1 follower


Asked: 2016-09-23 18:27:40 -0500

Seen: 159 times

Last updated: Oct 09 '16