Kill off old pftpx processes correctly

This commit is contained in:
Scott Ullrich 2007-07-07 03:20:05 +00:00
parent 2ab73e04d0
commit efb9942fd2

View File

@ -1708,6 +1708,16 @@ function system_start_ftp_helpers() {
/* loop through all interfaces and handle pftpx */
$interface_counter = 0;
if(isset($config['shaper']['enable'])) {
if(isset($config['ezshaper']['step5']['p2pcatchall'])) {
$shaper_queue = "-q qP2PDown ";
} else {
$downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']);
$shaper_queue = "-q {$downq}def ";
}
} else {
$shaper_queue = "";
}
foreach ($iflist as $ifent => $ifname) {
/* if the ftp proxy is disabled for this interface then kill pftpx
* instance and continue. note that the helpers for port forwards are
@ -1724,7 +1734,7 @@ function system_start_ftp_helpers() {
* keep processing interfaces. kill pftpx if already
* running for this instance.
*/
$helpers = exec("/bin/ps awux | grep \"/usr/local/sbin/pftpx -c {$port}\" | grep -v grep | sed \"s/ */ /g\" | cut -f2 -d\" \"");
$helpers = exec("/bin/ps awux | grep \"/usr/local/sbin/pftpx {$shaper_queue}-c {$port}\" | grep -v grep | sed \"s/ */ /g\" | cut -f2 -d\" \"");
if($helpers)
mwexec("/bin/kill {$helpers}");
$interface_counter++;
@ -1755,18 +1765,8 @@ function system_start_ftp_helpers() {
log_error("Config: AON rule matched for interface {$ifname} - using FTP proxy");
}
}
if(isset($config['shaper']['enable'])) {
if(isset($config['ezshaper']['step5']['p2pcatchall'])) {
$shaper_queue = "-q qP2PDown ";
} else {
$downq = "q" . convert_friendly_interface_to_friendly_descr($config['ezshaper']['step2']['inside_int']);
$shaper_queue = "-q {$downq}def ";
}
} else {
$shaper_queue = "";
}
/* if pftpx is already running then do not launch it again */
$helpers = exec("/bin/ps awux | grep \"/usr/local/sbin/pftpx -c {$port}\" | grep -v grep | sed \"s/ */ /g\"");
$helpers = exec("/bin/ps awux | grep \"/usr/local/sbin/pftpx {$shaper_queue}-c {$port}\" | grep -v grep | sed \"s/ */ /g\"");
if(!$helpers && $ip)
mwexec("/usr/local/sbin/pftpx {$shaper_queue}-c {$port} -g 8021 {$ip}");
if(!$ip)