opsengine / cpulimit

CPU usage limiter for Linux
Other
1.69k stars 270 forks source link

php with cpulimit #2

Closed remrem closed 12 years ago

remrem commented 12 years ago

Hi

I try to run a php script with cpulimit but, cpulimit always stop the script and the process still visible with "top" command ... just like 0 %CPU 0 %MEM

I try

./_cpulimit/cpulimit -l 90 -z -v "php /home/test/test.php"

but get

2 cpu detected
Running command: 'php /home/test/test.php'
Error: No such file or directory
Limiting process 23875
Priority changed to -10
Members in the process group owned by 23875: 1

%CPU    work quantum    sleep quantum   active rate
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
Process 23875 dead!
0.00%   100000 us            0 us       100.00%

if i just run

php /home/test/test.php

It's work fine.

I try to put in my php file

exec( "/home/test/_cpulimit/cpulimit -l 90 -v -z -p " . getmypid() );

but get

[2]+  Stopped                 php /home/test/test.php

I don't really understand where the problem is ... If you can help me ?

Thanks, RemRem

remrem commented 12 years ago

update ... I use ssh with putty to connect to my server

when I want to exit

exit

I get

logout
There are stopped jobs.
[2]-  Done                    php /home/test/test.php

without quit ssh ...

in my syslog

 kernel: cpulimit[23874]: segfault at 0 ip 000000000040138e sp 00007fff28ce0490 error 4 in cpulimit[400000+5000]
kernel: grsec: From 78.112.37.211: Segmentation fault occurred at (null) in /home/test/_cpulimit/cpulimit[cpulimit:23874] uid/euid:0/0 gid/egid:0/0, parent /bin/bash[bash:2599] uid/euid:0/0 gid/egid:0/0

for quit my server I must "exit" 2 times

opsengine commented 12 years ago

Hi, I think you should execute

./_cpulimit/cpulimit -l 90 -z -v php /home/test/test.php

instead of:

./_cpulimit/cpulimit -l 90 -z -v "php /home/test/test.php"

Please try and let me know

Angelo

remrem commented 12 years ago

It's work :) (shame on me)

Thanks for help.