Your message dated Tue, 21 Aug 2012 08:45:09 +0200
with message-id <20120821084509.5ccb408f@ileemo>
and subject line Re: Bug#685427: Provide ifrestart script
has caused the Debian Bug report #685427,
regarding Provide ifrestart script
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
685427: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685427
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: ifupdown
Version: any
Severity: wishlist
Tags: patch


Hello,


The usual way to restart an interface is:

ifdown $interface && ifup $interface


It will be nice and handy to provide an script (ifrestart) to do this.


I have implemented my own version of such script that does that, it also
allows to restart all interfaces with "ifrestart -a".


Feel free to modify it as you want.


Thanks!
#!/bin/sh
#
# script to restart network interfaces with "ifup && ifdown"
#
# Carlos Alberto Lopez Perez <[email protected]>
#
#
ifrestart () {
        # Avoid interface names starting with - (confuses ifquery evaluation)
        if ! echo "$1" | grep -q "^-" && ifquery "$1" >/dev/null; then
                ifdown "$1"
                ifup "$1"
                return $?
        else
                echo "Interface $1 is unknown"
                return 1
        fi
}

help () {
        echo "Use: "
        echo "\t$0 [interface-name]\t\t Restarts interface-name"
        echo "\t$0 -a, --all\t\t\t Restarts all interfaces (including 
allow-hotplug ones)"
        exit 0

}
if [ -z $1 ]; then
        help
fi

if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
        help
fi

if [ "$1" = "-a" ] || [ "$1" = "--all" ]; then
        echo "Restarting all interfaces ..."
        for iface in $(ifquery -l; ifquery -l --allow=hotplug); do
                ifrestart $iface
        done
else
        ifrestart $1
fi

exit $?

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
tag 685427 wontfix
thanks

Hello,

On Mon, 20 Aug 2012 20:28:22 +0200
Carlos Alberto Lopez Perez <[email protected]> wrote:

> The usual way to restart an interface is:

> ifdown $interface && ifup $interface

> It will be nice and handy to provide an script (ifrestart) to do this.

> I have implemented my own version of such script that does that, it
> also allows to restart all interfaces with "ifrestart -a".

There's 'reload' action of the networking init script, which restarts
all the interfaces currently up, and 'restart' which just puts
everything down, and then ups only those which have 'auto' (or
'allow-hotplug' while the interface's operating).

Probably, there may be a parameter to the initscript to limit its
action to just some interfaces, but I don't think it's worth to add
ifrestart, at least now.

-- 
WBR, Andrew

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to