How to run commands after connected to wifi network?

I want to run commands after connected to wifi

Open the terminal and type your command. You can also do it before being connected to wifi :wink:

But seriously, what’s the question :question:

1 Like

There are some commands that I want to be executed automatically whenever connected to Wi-Fi

This can surely be done in a shell script. Which commands would you like to run?

1 Like

Maybe you could use netctl and hooks where you put your scripts (depending on your intent). Section 4.6

Using hooks
netctl supports hooks in /etc/netctl/hooks/ and per interface hooks in /etc/netctl/interfaces/. You can set any option in a hook/interface that you can in a profile. Most importantly this includes ExecUpPost and ExecDownPre.

When a profile is read, netctl sources all executable scripts in hooks, then it reads the profile file for the connection and finally it sources an executable script with the name of the interface used in the profile from the interfaces directory. Therefore, declarations in an interface script override declarations in the profile, which override declarations in hooks.

The variables $INTERFACE and $ACTION are available in hooks/interfaces only when using netctl-auto


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.