Advertisement
Guest User

wlan

a guest
Nov 14th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # /etc/rc.d/wlan: start/stop wireless interface
  4. #
  5. DEV=wlp8s0
  6.  
  7.  
  8. SSD=/sbin/start-stop-daemon
  9. PROG_DHCP=/sbin/dhcpcd
  10. PROG_WIFI=/usr/sbin/wpa_supplicant
  11. PID_DHCP=/var/run/dhcpcd.pid
  12. PID_WIFI=/var/run/wpa_supplicant.pid
  13. OPTS_DHCP="--waitip -h $(/bin/hostname) -z $DEV"
  14. OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV"
  15.  
  16.  
  17. print_status() {
  18. $SSD --status --pidfile $2
  19. case $? in
  20. 0) echo "$1 is running with pid $(cat $2)" ;;
  21. 1) echo "$1 is not running but the pid file $2 exists" ;;
  22. 3) echo "$1 is not running" ;;
  23. 4) echo "Unable to determine the program status" ;;
  24. esac
  25. }
  26. case $1 in
  27. start)
  28. $SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI && \
  29. $SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP
  30. RETVAL=$?
  31. ;;
  32. stop)
  33. ( $SSD --stop --retry 10 --pidfile $PID_DHCP
  34. $SSD --stop --retry 10 --pidfile $PID_WIFI )
  35. RETVAL=$?
  36. ;;
  37. restart)
  38. $0 stop
  39. $0 start
  40. ;;
  41. status)
  42. print_status $PROG_WIFI $PID_WIFI
  43. print_status $PROG_DHCP $PID_DHCP
  44. ;;
  45. *)
  46. echo "Usage: $0 [start|stop|restart|status]"
  47. ;;
  48. esac
  49. exit $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement