summaryrefslogtreecommitdiffstats
path: root/etc/inc/interfaces.inc
diff options
context:
space:
mode:
authorthompsa <andy@fud.org.nz>2010-03-12 14:14:15 +1300
committerthompsa <andy@fud.org.nz>2010-03-12 14:14:15 +1300
commit6f76920c94c2299240112b3ce9bd3238b9726989 (patch)
treeffb598e32526596b03d66e67165072256d6a5722 /etc/inc/interfaces.inc
parent6661ea2525eb3d43069ad01616f1f905be94029c (diff)
downloadpfsense-6f76920c94c2299240112b3ce9bd3238b9726989.zip
pfsense-6f76920c94c2299240112b3ce9bd3238b9726989.tar.gz
Use pgrep/pkill to save a bit of cpu.
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r--etc/inc/interfaces.inc10
1 files changed, 4 insertions, 6 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index c31e259..7dd1ef6 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -985,7 +985,7 @@ function interface_ppp_configure($ifcfg,$edit=false) {
}
// Launch specified ppp instance
if( (!$edit || $g['booting']) && file_exists("/dev/{$orig_dev}")){
- $running = `ps awux | grep ppp | grep -v grep | grep $orig_dev`;
+ $running = `/bin/pgrep -f "ppp .* $orig_dev"`;
if(!$running)
mwexec_bg("/usr/sbin/ppp -background {$orig_dev}");
}
@@ -1750,18 +1750,16 @@ EOD;
}
function kill_hostapd($interface) {
- return "/bin/ps awwuxx | grep hostapd | grep $interface | awk '{ print \$2 }' | xargs kill\n";
+ return "/bin/pkill -f \"hostapd .*{$interface}\"\n";
}
function kill_wpasupplicant($interface) {
- return "/bin/ps awwuxx | grep wpa_supplicant | grep $interface | awk '{ print \$2 }' | xargs kill\n";
+ return "/bin/pkill -f \"wpa_supplicant .*{$interface}\"\n";
}
function find_dhclient_process($interface) {
if($interface) {
- $pid = `ps awwwux | grep dhclient | grep -v grep | grep {$interface} | awk '{ print \$2 }'`;
- $pid = explode("\n", $pid);
- $pid = $pid[0];
+ $pid = `/bin/pgrep -xf "dhclient: {$interface}"`;
}
return $pid;
}
OpenPOWER on IntegriCloud