Колян 2 Posted 2007-07-04 14:56:15 Share Posted 2007-07-04 14:56:15 В связи с тем, что стг часто падает из-за обрыва коннекта с БД, написал скриптик для проверки состояния и восстановления. #!/usr/bin/php <?php $conf[server]="127.0.0.1"; $conf[port]="5555"; $conf[admin]="admin"; $conf[adminpass]="admin_pwd"; function execute($string){ global $conf; $f_ans = @popen("/bin/sgconf -s $conf[server] -p $conf[port] -a $conf[admin] -w $conf[adminpass] -r '$string'", "r"); while (!@feof($f_ans)) $ans .= @fread($f_ans, 2048); @pclose($f_ans); $ans=iconv("KOI8-R", "WINDOWS-1251", $ans); return $ans; } $date=execute("<getusers/>"); $strlen=strlen($date); if ($strlen<30) { system (" killall -9 stargazer unlink stargazer.core unlink /stargazer.core unlink /root/stargazer.core stargazer "); } ?> Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now