LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-23-2012, 12:17 PM   #1
Pratt
Member
 
Registered: Apr 2005
Location: Colombia
Distribution: Slackware 14.2
Posts: 82

Rep: Reputation: 18
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!
 
Old 12-23-2012, 01:16 PM   #2
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
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

Last edited by bijo505; 12-24-2012 at 12:05 AM. Reason: Exit status was not properly mentioned.
 
Old 12-23-2012, 05:35 PM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

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


Reply

Tags
network manager, nm-applet



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installation user scripts to custom packages selection beder Slackware 7 04-19-2011 01:34 PM
Suspend/Resume - custom scripts and mouse issues Arcalyth Linux - Laptop and Netbook 0 02-17-2009 05:30 PM
Place for custom made system scripts the_gripmaster Linux - General 5 11-26-2008 04:29 PM
MRTG Custom Scripts Analysis RaelOM Linux - Software 2 07-11-2006 10:13 AM
Custom scripts Minnie000 Linspire/Freespire 1 04-24-2005 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration