[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: end of resume sequence (to run my USB network fixup script)



On 06/09/13 03:27, Zenaan Harkness wrote:
Gday, when I come out of hibernate, I have to run ifdown, ifup, for my
ethernet device to make it work again (it's a USB device).

I would like my ifup/ifdown script to work automatically.

My /etc/network/interfaces does not have auto for my ethernet device,
because I only want internet when I want it - I do not want the device
on all the time, but if it was on when I hibernated, I do want it to
be re-enabled when I come out of hibernation.

I hope this makes sense.

I can think of at least one way of doing it.

Do you have a script that you run when you want the network to start and stop?

If so, make it write the desired state to a file somewhere. Let's use "on" and "off" as the contents of the file.

Then set up the device in /e/n/i like this. I'm using eth9 as an example, and assuming your net status file will be /var/run/netstatus.

auto eth9
iface eth9 inet dhcp
    pre-up ( grep -q "on" /var/run/netstatus)

If the grep fails to find "on" in the file it will return 1 and the interface won't be started.

If it does find "on", it will return 0 and the interface will be started.

--
Dom


Reply to: