Hello this is my first post in this forum,I hope I can stay here for long and learn things from you guys.
I have added a PHP code to first line of my PHP script , which prevents the scrtip be runned if "Server Load" be more than 5
(server load shows how busy the CPU is) ,
I have a PERL script too, and I want to add that code to the begning of my PL script too, please kindly cover this PHP code to Perl for me .
PHP Code:
$LoadAvg = substr(file_get_contents('/proc/loadavg'), 0, 4);
if($LoadAvg > 5)
{
echo "Server busy, try again some minutes later.";
}
else
{
//Run Script.
}
?>
Thanks in advance.
I have added a PHP code to first line of my PHP script , which prevents the scrtip be runned if "Server Load" be more than 5
(server load shows how busy the CPU is) ,
I have a PERL script too, and I want to add that code to the begning of my PL script too, please kindly cover this PHP code to Perl for me .
PHP Code:
Code:
<?php $LoadAvg = substr(file_get_contents('/proc/loadavg'), 0, 4);
if($LoadAvg > 5)
{
echo "Server busy, try again some minutes later.";
}
else
{
//Run Script.
}
?>
Thanks in advance.