shell scripting
Oliver Grawert
ogra at ubuntu.com
Mon Nov 11 11:17:33 UTC 2013
hi,
Am Samstag, den 09.11.2013, 17:23 +0100 schrieb pluto mars:
> Hi,
>
>
> I need some help with shell scripting (/bin/sh) in ubuntu.
>
>
> In a shell script I want to turn down an interface, say eth0 and then
> turn it up.
>
> So something like
>
>
> ifdown eth0
>
> ifup eth0
>
>
> But what I want in my shell script is to check and wait till eth0 is
> up and then start doing something next in my shell script.
>
> So something like "if ( eth0 not is up ) { sleep 1 }. But how do I do
> this in shell scripting ?
>
try using an upstart job instead ;) this will be 10x easier, smaller and
perfectly reliable (vs polling the device or pinging a router or
whatever)
http://upstart.ubuntu.com/cookbook/
alternatively an if-up.d script could work as well (though there you
still would have to poll for syslog running which upstart gives you for
free via events)
/etc/network/if-up.d/openssh-server is a good example of an if-up.d
script that triggers on specific interfaces (if you have ssh installed)
ciao
oli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20131111/6c396c03/attachment.sig>
More information about the ubuntu-users
mailing list