[Solved] Run a script when network is connected

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mikejp56
Level 2
Level 2
Posts: 70
Joined: Mon Oct 21, 2019 8:06 am
Location: Maryland USA

[Solved] Run a script when network is connected

Post by mikejp56 »

Hi All,
I have a PC that is used as a wireless print server in my house. I also have 2 available wifi networks whenever a PC boots up, default and Max116.The PCs select one of the 2; I do not know why they do not always select the same one.
I have a script that when it runs, it tells me which one is connected. I use this because the display for the printer PC is in a hard place to see, and the script displays in 128 point font, which makes it easier to see.
So I have 2 questions:
1) How do I force the PCs to boot to the same network all of the time?
2) How do I get the script to run when the network connection is made?
Either of these will suffice; I have not been able to figure out #1, and I have done extensive research on #2 and I cannot get that to work.
Thanks for reading!
Regards,
mikejp56
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
greengnome
Level 2
Level 2
Posts: 74
Joined: Wed Oct 16, 2019 6:41 am

Re: Run a script when network is connected

Post by greengnome »

1) In the Network Manager under Network Connections you can set per network "Connect automatically with priority". So either have only one of your networks on autoconnect or try setting different priorities on them.
mikejp56
Level 2
Level 2
Posts: 70
Joined: Mon Oct 21, 2019 8:06 am
Location: Maryland USA

Re: Run a script when network is connected

Post by mikejp56 »

Hi greengnome,
Thanks, I was wondering if that was what that was for.
And now I know.
Regards,
mikejp56
Locked

Return to “Networking”