LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   NetworkManager and Custom scripts (http://www.linuxquestions.org/questions/slackware-14/networkmanager-and-custom-scripts-4175442693/)

Pratt 12-23-2012 12:17 PM

NetworkManager and Custom scripts
 
Hello Friends!

Im using network manager (and nm-applet) to manage my connections. What I would like to do automatically, is to run a custom script when I successfuly connect to a wireless network and run another custom script when I close that connection.

Ive been looking around for information about this topic but I havent got any luck finding it. Any Ideas on how to do this?

Happy Holidays!

bijo505 12-23-2012 01:16 PM

Hi,

I am not sure, whether you are looking like this or not.

#!/bin/bash
GW=<Gateway IP>;
ping -c 1 $GW > /dev/null
exitstatus=$?;
[ $exitstatus -eq 0 ] && [ ! -e ~/enable ] && <command to run> && touch ~/enable && exit # This line will execute after getting the connection
[ $exitstatus -ne 0 ] && rm ~/enable && <command to execute> # This line will execute at the end

I hope this logic will work... but didn't check..
--
Thanks,
Bijo

allend 12-23-2012 05:35 PM

Perhaps this will help. http://www.linuxquestions.org/questi...1/#post4579765


All times are GMT -5. The time now is 02:59 AM.