diff options
author | punk <punk@libernaut> | 2021-04-21 15:26:19 +0100 |
---|---|---|
committer | punk <punk@libernaut> | 2021-04-21 15:26:19 +0100 |
commit | eac48b5a8d709135a95abcc2243b369095f074f4 (patch) | |
tree | a2e34d995cef5ac8068ec7047e93b1125c80d175 /linux/conf/rc.d/wlan | |
parent | 3bd43803fc8cb7a39a87394cb7c491ddc151e06b (diff) | |
parent | 452477a2635d85ecf772a5242ce97d9479503bb3 (diff) | |
download | doc-eac48b5a8d709135a95abcc2243b369095f074f4.tar.gz |
release 0.7.0
Diffstat (limited to 'linux/conf/rc.d/wlan')
-rwxr-xr-x | linux/conf/rc.d/wlan | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/linux/conf/rc.d/wlan b/linux/conf/rc.d/wlan new file mode 100755 index 0000000..9a2f935 --- /dev/null +++ b/linux/conf/rc.d/wlan @@ -0,0 +1,56 @@ +#!/bin/sh +# +# /etc/rc.d/wlan: start/stop wireless interface +# + +DEV=wlp3s0 + + +SSD=/sbin/start-stop-daemon +PROG_DHCP=/sbin/dhcpcd +PROG_WIFI=/usr/sbin/wpa_supplicant +PID_DHCP=/var/run/dhcpcd.pid +PID_WIFI=/var/run/wpa_supplicant.pid + +OPTS_DHCP="--waitip -h $(/bin/hostname) -z $DEV" +OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV" + + +print_status() { + $SSD --status --pidfile $2 + case $? in + 0) echo "$1 is running with pid $(cat $2)" ;; + 1) echo "$1 is not running but the pid file $2 exists" ;; + 3) echo "$1 is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac +} + +case $1 in + start) + $SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI && \ + $SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP + RETVAL=$? + ;; + stop) + ( $SSD --stop --retry 10 --pidfile $PID_DHCP + $SSD --stop --retry 10 --pidfile $PID_WIFI ) + RETVAL=$? + ;; + restart) + $0 stop + $0 start + ;; + status) + print_status $PROG_WIFI $PID_WIFI + print_status $PROG_DHCP $PID_DHCP + ;; + *) + echo "Usage: $0 [start|stop|restart|status]" + ;; +esac + +exit $RETVAL + +# End of file + |