pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

nephix private pastebin - collaborative debugging tool What's a private pastebin?


Posted by nephix on Fri 4 Apr 12:02
report abuse | download | new post

  1. #!/bin/sh
  2. #
  3. # description:  This small start/stop-script will let you control
  4. #               your wpa_supplicant application to handle its correct
  5. #               usage.
  6. # @name:        wpa_supplicant.sh
  7. # @author:      Thomas Pischulski <Thomas.Pischulski@mailbox.tu-dresden.de>
  8. # @expanded:    Alexander Hagenah <ah@primepage.de>
  9. # @created:     04/02/2008
  10.  
  11.  
  12. # VARIABLES
  13. # Edit them to match your system settings
  14. DEVICE="wlan0"
  15. CONFIG="/etc/wpa_supplicant/wpa_supplicant.conf"
  16. USERID=`id -u`
  17. ANSWER=""
  18.  
  19.  
  20. if [ $USERID != 0 ]; then
  21.         echo "You're not root"
  22.         exit 0
  23.  
  24. else
  25.         case "$1" in
  26.                 "start")
  27.                         WPAPID=`pidof wpa_supplicant`
  28.                         if [ $? -eq 0 ]; then
  29.                                 echo "wpa_supplicant process still running."
  30.                                 echo "Kill it? [y/n] "
  31.                                 read ANSWER
  32.  
  33.                                 case "$ANSWER" in
  34.                        
  35.                                         "y"|"Y")
  36.                                                 kill -9 $WPAPID
  37.                                         ;;
  38.  
  39.                                         "n"|"N")
  40.                                                 echo "Could not start wpa_supplicant because another"
  41.                                                 echo "process is still running. Exiting.."
  42.                                                 exit 0
  43.                                         ;;
  44.  
  45.                                         *)
  46.                                                 echo "Answer not allowed. Exiting.."
  47.                                                 exit 0
  48.                                 esac
  49.                         fi
  50.                                
  51.                         ifconfig $DEVICE up
  52.                         wpa_supplicant -dd -B -c $CONFIG -i $DEVICE -D wext
  53.                         dhclient $DEVICE
  54.                 ;;
  55.  
  56.                 "stop") 
  57.                         ifconfig $DEVICE down
  58.                         killall wpa_supplicant
  59.                 ;;
  60.  
  61.                 *) echo "No argument given. Usage: wlanfrz (start|stop)";
  62.         esac
  63. fi

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post