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

Check for ps support in ProcessCleanUpHook #758

Open
kpnielsen opened this issue Jul 13, 2021 · 3 comments
Open

Check for ps support in ProcessCleanUpHook #758

kpnielsen opened this issue Jul 13, 2021 · 3 comments

Comments

@kpnielsen
Copy link
Contributor

Feature Request

Is your feature request related to a problem? Please describe.
On some shared hosting environments (e.g. Mittwald which is very popular in Germany) the ps command is not available due to security considerations. The ProcessCleanUpHook uses ps to find orphaned queue processes if the option cleanup.cleanUpOldQueueEntries is set to true.

Describe the solution you would like
Ideally the hook would check whether ps is can be executed and try to execute an alternative, if it is not. I don't know of any such alternatives, though.

Describe alternatives you've considered
Alternatively, the hook could use try {} catch() {} and merely print out a warning.

@tomasnorre
Copy link
Owner

Hi @kpnielsen

Thanks for your input. I wasn't aware of that, and will try to come up with another solution on how to detect this.

@kpnielsen
Copy link
Contributor Author

Just got back to this because a colleague of mine stumbled across this very same problem, again.
It might be enough to wrap the exec('ps aux ...') call in the hook with an if-statement like so

// …
if (`which ps`) {
    exec('');
} else {
    trigger_error("Cannot locate ps command", E_USER_WARNING);
}
// …

This would at least prevent the scheduler from failing altogether. Is there anything that speaks against it?

@tomasnorre
Copy link
Owner

This would at least stop the scheduler from failing, but would still not make the crawler working on systems without ps.

So we can add this for now, and still consider better options.
Would you mind creating the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants