summaryrefslogtreecommitdiffstats
path: root/rc.wireless
diff options
context:
space:
mode:
authorJakub Jankowski <shasta@toxcorp.com>2018-01-08 03:49:26 +0100
committerRobby Workman <rworkman@slackware.com>2018-05-24 01:23:40 -0500
commit59e0a7610c708c0799b141715863167ed87babd8 (patch)
tree25c53b402d5f5201011f06975e324e7b2a6404a9 /rc.wireless
parentcda761f22b855806f338ece31734df1ce4824ad6 (diff)
downloadslacknetsetup-59e0a7610c708c0799b141715863167ed87babd8.tar.xz
Use pkill/pgrep
Instead of heavy subshelling, use pkill/pgrep. Also, be a bit more specific on what we're killing. Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
Diffstat (limited to 'rc.wireless')
-rw-r--r--rc.wireless6
1 files changed, 2 insertions, 4 deletions
diff --git a/rc.wireless b/rc.wireless
index 3b09e2e..a4b20a1 100644
--- a/rc.wireless
+++ b/rc.wireless
@@ -110,8 +110,7 @@ is_wireless_device ${INTERFACE} || return 0 2> /dev/null || exit 0
# If we stop a wireless interface using wpa_supplicant,
# we'll kill its wpa_supplicant daemon too and exit this script:
if [ "$2" = "stop" ]; then
- WPAPID=$(echo $(ps axww | grep wpa_supplicant | grep i${INTERFACE}) | cut -f1 -d' ')
- [ ${WPAPID} ] && kill ${WPAPID}
+ pkill --full "bin/wpa_supplicant.* -i${INTERFACE}"
return 0
fi
@@ -294,8 +293,7 @@ if [ "$WPA" = "wpa_supplicant" ] || [ "$WPA" = "wpaxsupplicant" ] && [ -x ${SUPP
[ ${WPA} = "wpaxsupplicant" ] && WPA_OPTIONS="${WPA_OPTIONS} -e" # Use external xsupplicant (disables the internal supplicant)
# We leave a running wpa_supplicant process in peace:
- WPAPID=$(echo $(ps axww | grep wpa_supplicant | grep i${INTERFACE}) | cut -f1 -d' ')
- if [ ${WPAPID} ]; then
+ if pgrep --full "bin/wpa_supplicant.* -i${INTERFACE}" >/dev/null ; then
echo "$0: wpa_supplicant found running already" | $LOGGER
else
echo "$0: wpa_supplicant -B -c${WPACONF} ${WPA_OPTIONS} -i$INTERFACE" | $LOGGER