Created
March 8, 2012 13:03
-
-
Save s4l1h/2000907 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// crontab ile bu dosyayı 1 2 dakikada bir çalıştırarak eğer sunucu 502 gateway hatası vermişse o anki bazı çıktıları kaydedip | |
// php-cgi'ye reset atacağız. | |
// test edilecek site | |
$adres="http://www.tesedileceksite.com/"; | |
$kaynak=file_get_contents($adres); | |
$desen="@502@"; | |
$komutlar=array( | |
// o anki top c çıktısı | |
'top -c > /root/top.txt', | |
// php process çıktısı | |
'ps -aux | grep php > /root/grep_php.txt', | |
// php-cgi process çıktısı | |
'ps -aux | grep php-cgi > /root/grep_php_cgi.txt', | |
// o anki tmp çıktısı | |
'ls -la /tmp > /root/tmp.txt', | |
// php-cgi'ye reset atalım | |
'sh /root/resetphp.sh', // https://gist.github.com/2000909 | |
); | |
if(preg_match($desen,$kaynak,$cikti)){ | |
foreach($komutlar As $komut){ | |
system($komut); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment