How to restart a single network interface properly?

I know I can run
Code:
# /etc/rc.d/netif restart
which restarts ALL network interfaces and kicks me out of ssh and if something goes wrong I am screwed.

Is there a way to only restart wlan0?

At the moment I do it like this:
Code:
# ifconfig wlan0 down
# ifconfig wlan0 up
# wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
# route add default 192.168.1.254

It would be nice to have a netif script that takes the interface as a parameter or something. For example in Gentoo Linux you can link all interfaces to net.lo (if you want to, otherwise udev does that for you):
Code:
# ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0
This enables you to control the interface wlan0 directly.

Looking into the script itself, it looks rather complicated and I don't want to break things... of course there must be a better way?
 
Jesus, I knew there must be an easy way :D
I really searched my a** off for this...

Thanks!
 
Back
Top