Command/StopWorkerTenderCommand.php
private function findWorkerTenderProcessesForTube($tube)
    {
        $processes = array();
        $command = "ps ax ";
        $command .= "|grep php ";
        $command .= "|grep -v stop ";
        $command .= "|grep worker-tender ";
        if ($tube !== '') {
            $command .= "|grep " . escapeshellarg('use-tube=' . $tube);
        }
        $data = exec($command);
        $lines = explode("\n", $data);
        foreach ($lines as $line) {
            $line = trim($line);
            $parts = explode(" ", $line);
            if ($parts[0] === '') {
                continue;
            }
            $processes[] = intval($parts[0]);
        }

        return $processes;

    }
private function findWorkerTenderProcessesForTube($tube)
    {
        $processes = array();
        $command = "ps ax ";
        $command .= "|grep php ";
        $command .= "|grep -v stop ";
        $command .= "|grep worker-tender ";
        if ($tube !== '') {
            $command .= "|grep " . escapeshellarg('use-tube=' . $tube);
        }
        $data = exec($command);
        $lines = explode("\n", $data);
        foreach ($lines as $line) {
            $line = trim($line);
            $parts = explode(" ", $line);
            if ($parts[0] === '') {
                continue;
            }
            $processes[] = intval($parts[0]);
        }

        return $processes;

    }
private function findWorkerTenderProcessesForTube ( $ tube ) { $ processes = array ( ) ; $ command = "ps ax " ; $ command .= "|grep php " ; $ command .= "|grep -v stop " ; $ command .= "|grep worker-tender " ; if ( $ tube !== '' ) { $ command .= "|grep " . escapeshellarg ( 'use-tube=' . $ tube ) ; } $ data = exec ( $ command ) ; $ lines = explode ( "\n" , $ data ) ; foreach ( $ lines as $ line ) { $ line = trim ( $ line ) ; $ parts = explode ( " " , $ line ) ; if ( $ parts [ 0 ] === '' ) { continue ; } $ processes [ ] = intval ( $ parts [ 0 ] ) ; } return $ processes ; }
Returns a list of processes that match the worker-tender

@param string $tube
@return array
Returns a list of processes that match the worker - tender