How to automatically start wpa_supplicant at boot

Matti Lattu matti.lattu at helsinki.fi
Sun Apr 3 07:47:17 EDT 2005


Erich Noll wrote:

> Now I would like to get wpa_supplicant to start automatically as the 
> machine is booting up.  I've tried several ways of starting it but had 
> no success so far.

I just wrote a following init.d script for my wpa_supplicant/Ubuntu 
Linux. You may want to  edit the output lines (log_XXX_msg).

Place the script to your /etc/init.d, chown root.root and chmod 755. 
Don't forget to add relevant symlinks to your /etc/rcX.d directories.


#!/bin/sh
# Start/stop the wlan_supplicant daemon.

WPA_BIN=/usr/local/bin/wpa_supplicant
WPACLI_BIN=/usr/local/bin/wpa_cli

test -f $WPA_BIN || exit 0

#LSBNAMES='-l'  # Uncomment for LSB name support in /etc/cron.d/

. /lib/lsb/init-functions

case "$1" in
start)  log_begin_msg "Starting wpa_supplicant..."
        $WPA_BIN -w -c /etc/wpa_supplicant.conf -D ipw -i eth1 -B
        log_end_msg $?
        ;;
stop)   log_begin_msg "Stopping wpa_supplicant..."
        $WPACLI_BIN terminate
        log_end_msg $?
        ;;
restart)
        $0 stop
        $0 start
        ;;
*)      log_success_msg "Usage: /etc/init.d/wpa_supplicant 
start|stop|restart"
        exit 1
        ;;
esac
exit 0




More information about the HostAP mailing list