FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 07-08-2010, 10:17 PM
xf mail
 
Default Upstart network connection event?

Hi all,



I'm writing an Upstart script which would run in the event a network
cable is connected (i.e., the network interface get's an IP address.)
However, I am having trouble figuring out which event I should use for
the 'start on' directive.



Output of 'initctl list | grep network' shows the following networking related events:



network-manager start/running, process 843

network-interface (lo) start/running

network-interface (eth0) start/running

network-interface (wlan0) start/running

network-interface-security start/running

networking stop/waiting



network-manager starts at boot and doesn't change after that if the
cable is disconnected so taht won't work. Also the network-interface*
events stay started once the system is booted.



The description for 'networking' states "This task causes virtual
network devices that do not have an associated kernel object to be
started on boot." So I'm not sure that is an option.



I'm thinking perhaps there is a udevmonitor event I can use, but again, I'm not sure which one?



Does anyone have any experience with building scripts like this?

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-31-2010, 03:27 PM
"S. Zeier"
 
Default Upstart network connection event?

Hi,

on my Ubuntu 10.04 LTS machine I had the same problem...

One possible solution might look like this:

The event to be used in your upstart script is
...
start on net-device-up
...

Event "net-device-up" is emitted by upstart script

/etc/network/if-up.d/upstart

and provides shell variable IFACE you can use
to trigger interface dependent actions - in case your host
has several network cards equipped.

Example:

...
start on net-device-up
...
script
if [ "$IFACE" = eth0 ]
then
# do this stuff
else
if [ "$IFACE" = eth1 ]
then
# do that stuff
fi
end script


Hope this helps...
Cheers!



> Hi all,
>
> I'm writing an Upstart script which would run in the event a network cable
> is connected (i.e., the network interface get's an IP address.) However, I
> am having trouble figuring out which event I should use for the 'start on'
> directive.
>
> Output of 'initctl list | grep network' shows the following networking
> related events:
>
> network-manager start/running, process 843
> network-interface (lo) start/running
> network-interface (eth0) start/running
> network-interface (wlan0) start/running
> network-interface-security start/running
> networking stop/waiting
>
> network-manager starts at boot and doesn't change after that if the
> cable is
> disconnected so taht won't work. Also the network-interface* events stay
> started once the system is booted.
>
> The description for 'networking' states "This task causes virtual network
> devices that do not have an associated kernel object to be started on
> boot."
> So I'm not sure that is an option.
>
> I'm thinking perhaps there is a udevmonitor event I can use, but again, I'm
> not sure which one?
>
> Does anyone have any experience with building scripts like this?

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 02:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org