* Use full path to grep and awk

* Test for p and not -p
This commit is contained in:
Scott Ullrich 2008-12-23 22:08:20 +00:00
parent 855d186191
commit 2f7487d363
2 changed files with 4 additions and 4 deletions

View File

@ -569,13 +569,13 @@ function filter_nat_rules_generate()
if($int && $external_address && $internal_address) {
$natrules .= "# FTP Helper binat\n";
$natrules .= "no binat on {$int} proto tcp from any to {$external_address} port 21\n";
$helpers = exec("/bin/ps awux | grep \"\-p 21 -R {$internal_address} -b {$external_address}\" | grep -v grep");
$helpers = exec("/bin/ps awux | /usr/bin/grep \"p 21 -R {$internal_address} -b {$external_address}\" | /usr/bin/grep -v grep");
if(!$helpers) {
/* Get the ftp queue for this interface */
if (isset($config['interfaces'][$rule['interface']]['ftpqueue']))
$shaper_queue = $config['interfaces'][$rule['interface']]['ftpqueue'];
$shaper_queue = "-q " . $config['interfaces'][$rule['interface']]['ftpqueue'];
/* else default queue configured on shaper will get this */
$after_filter_configure_run[] = "/usr/local/sbin/ftp-proxy {$shaper_queue} -p 21 -R {$internal_address} -b {$external_address} -T PFFTPPROXY";
$after_filter_configure_run[] = "/usr/local/sbin/ftp-proxy {$shaper_queue} -p 21 -R {$internal_address} -b {$external_address} -T PFFTPPROXY {$shaper_queue}";
}
}
}

View File

@ -122,7 +122,7 @@ if ($_POST) {
if($a_1to1[$id]['useftphelper']) {
if($a_1to1[$id]['external'] != $_POST['external'] or
$a_1to1[$id]['internal'] != $_POST['internal'] or !$_POST['useftphelper']) {
$helpers = `/bin/ps awux | grep "p 21 -R {$a_1to1[$id]['internal']} -b {$a_1to1[$id]['external']}" | grep -v grep | awk '{ print $2 }'`;
$helpers = `/bin/ps awux | /usr/bin/grep "p 21 -R {$a_1to1[$id]['internal']} -b {$a_1to1[$id]['external']}" | /usr/bin/grep -v grep | /usr/bin/awk '{ print $2 }'`;
if($helpers)
exec("kill $helpers");
}