Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute 'ps ex 2>/dev/null | awk '{print $1}' 2>/dev/null' #8286

Closed
parruc opened this issue Jul 7, 2015 · 3 comments
Closed

Unable to execute 'ps ex 2>/dev/null | awk '{print $1}' 2>/dev/null' #8286

parruc opened this issue Jul 7, 2015 · 3 comments
Labels
worksforme The issue cannot be reproduced and things work as intended.

Comments

@parruc
Copy link
Contributor

parruc commented Jul 7, 2015

We have the same error reported here: #6222 but on the ps that gets running processes:

     static function getRunningProcesses()
    {   
        $ids = explode("\n", trim(`ps ex 2>/dev/null | awk '{print $1}' 2>/dev/null`));

        $ids = array_map('intval', $ids);
        $ids = array_filter($ids, function ($id) {
            return $id > 0;
        });

        return $ids;
    }

Running it manually in the bash we get a list of process ids but from php we get

WARNING CoreConsole[2015-07-07 07:49:33] /var/www/piwik/core/CliMulti/Process.php(248):
 Warning - shell_exec(): Unable to execute 'ps ex 2>/dev/null | awk '{print $1}' 2>/dev/null' - 
Piwik 2.13.1 - Please report this message in the Piwik forums: http://forum.piwik.org
 (please do a search first as it might have been reported already)
@mattab
Copy link
Member

mattab commented Jul 15, 2015

Hi @parruc

In CLI / ssh, do these command output a lot of text (ie. are they working)

  • php -r "echo shell_exec('ps ex');"
  • php -r "echo shell_exec('ps ex 2>/dev/null | awk \'{print $1}\' 2>/dev/null');"

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Jul 15, 2015
@mattab mattab added this to the Short term milestone Jul 15, 2015
@mnapoli
Copy link
Contributor

mnapoli commented Jul 20, 2015

Please also try this one:

php -r "echo shell_exec('ps ex | awk \'{print $1}\'');"

@parruc
Copy link
Contributor Author

parruc commented Jul 27, 2015

Launched from the cli, works as expected and did not happen anymore, so I guess It was a memory problem or something similar... Closing it

@parruc parruc closed this as completed Jul 27, 2015
@mnapoli mnapoli added worksforme The issue cannot be reproduced and things work as intended. and removed Bug For errors / faults / flaws / inconsistencies etc. labels Jul 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants