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

How to use cpulimit in crontab #89

Open
kgpanteon opened this issue Sep 12, 2019 · 3 comments
Open

How to use cpulimit in crontab #89

kgpanteon opened this issue Sep 12, 2019 · 3 comments

Comments

@kgpanteon
Copy link

I have symfony based application, in which we are running command in crontab

1 0 * * *  /usr/bin/php /home/ec2-user/public_html/project/app/console myproject:currency:update

Change to

1 0 * * *  /usr/bin/cpulimit -l 10 /usr/bin/php home/ec2-user/public_html/project/app/console myproject:currency:update

Does this work?

@ghost
Copy link

ghost commented Dec 26, 2019

1 0 * * * cpulimit -l 10 (Some Script/Program) & This works for me. Im on a rpi3 B running jessie.

@kgpanteon
Copy link
Author

kgpanteon commented Jan 31, 2020

I have added this to crontab, sometimes cpulimit is not applied to cron command. Any reason?

I am using symfony process creation method to run command

$commandline=/usr/bin/cpulimit -l 10 /usr/bin/php home/ec2-user/public_html/project/app/console myproject:currency:update

$process = new Process($commandline);
$process->setWorkingDirectory($rootDirPath);
$process->disableOutput();
$process->setTimeout(0);
$process->run();`

When doing top -c command in console process showing without /usr/bin/cpulimit -l 10

@ivanmonteiro
Copy link

After some minutes of troubleshooting, It seems that using the option -mor --monitor-forks is working for me:
cpulimit -m -l 10 COMMAND

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

No branches or pull requests

2 participants