Fixed adminpanel
This commit is contained in:
parent
b1b3655a0d
commit
7e73fc4956
1 changed files with 27 additions and 30 deletions
|
@ -35,10 +35,8 @@ class manage_chat_panel extends admin_module{
|
|||
global $config, $db,$panel, $cache, $session;
|
||||
if(isset($_POST['start'])){
|
||||
$istat = $this->get_status();
|
||||
exec('/bin/systemctl status austria|grep running',$cat);
|
||||
$cat = trim($cat[0]);
|
||||
if($istat==2 && $cat!="not"){
|
||||
shell_exec("kill -9 ".$cat);
|
||||
if($istat['status']==2){
|
||||
shell_exec("kill -9 ".$istat['pid']);
|
||||
sleep(5);
|
||||
shell_exec("sudo /bin/systemctl restart austria");
|
||||
}else{
|
||||
|
@ -47,10 +45,12 @@ class manage_chat_panel extends admin_module{
|
|||
$panel->admin_message("Triggered", 'The Chatstart has been triggered. please refresh the page to see if it was successful.',TRUE,"manage_chat");
|
||||
}elseif(isset($_POST['emergency'])){
|
||||
$istat = $this->get_status();
|
||||
if($istat==1){
|
||||
shell_exec("sudo /sbin/restart topia");
|
||||
}elseif($istat==2){
|
||||
shell_exec("sudo /sbin/restart topia");
|
||||
if($istat['status']==1){
|
||||
shell_exec("sudo /bin/systemctl restart austria");
|
||||
}elseif($istat['status']==2){
|
||||
shell_exec("kill -9 ".$istat['pid']);
|
||||
sleep(5);
|
||||
shell_exec("sudo /bin/systemctl restart austria");
|
||||
}
|
||||
$panel->admin_message("Triggered", 'The Emergency Chatrestart has been triggered. please refresh the page to see if it was successful.',TRUE,"manage_chat");
|
||||
}else{
|
||||
|
@ -74,40 +74,37 @@ class manage_chat_panel extends admin_module{
|
|||
|
||||
function get_readable_status($status){
|
||||
global $db, $config, $cache, $log;
|
||||
if($status==1){
|
||||
exec('/sbin/status topia|awk \'{ print $4}\'',$cat);
|
||||
$cat = trim($cat[0]);
|
||||
return '<span style="color:green;">OK - Running - Process ID: '.$cat.'</span>';
|
||||
}elseif($status==2){
|
||||
exec('/sbin/status topia|awk \'{ print $4}\'',$cat);
|
||||
$cat = trim($cat[0]);
|
||||
return '<span style="color:red;">ALERT - Zombie - Process ID: '.$cat.'</span>';
|
||||
if($status['status']==1){
|
||||
return '<span style="color:green;">OK - Running - Process ID: '.$status['pid'].'</span>';
|
||||
}elseif($status['status']==2){
|
||||
return '<span style="color:red;">ALERT - Zombie - Process ID: '.$status['pid'].'</span>';
|
||||
}else{
|
||||
return '<span style="color:red;">ALERT - Stopped</span>';
|
||||
}
|
||||
}
|
||||
|
||||
function get_status(){
|
||||
global $db, $config, $cache, $log;
|
||||
$dat="/sbin/status topia|awk '{ print $4}'";
|
||||
$dat='/bin/systemctl status austria|grep "Main PID"';
|
||||
exec($dat,$cat);
|
||||
$cat = trim($cat[0]);
|
||||
if($cat!='not'){
|
||||
exec("ps ax|grep ".$cat."|grep -v grep",$ps);
|
||||
$data = explode(" ",$cat[0]);
|
||||
$r['pid'] = $data[5];
|
||||
exec("ps ax|grep ".$r['pid']."|grep -v grep",$ps);
|
||||
if(empty($ps)){
|
||||
$r['status'] = 0;
|
||||
} else {
|
||||
$psr = preg_split("/\s/", $ps[0]);
|
||||
$psr = $this->removeEmptyValues($psr);
|
||||
$status = $psr[2];
|
||||
$status=substr($status, 0, 1);
|
||||
if($status=="S"||$status=="R"){
|
||||
return 1;
|
||||
}elseif($status=="Z"){
|
||||
return 2;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
return 0;
|
||||
if($status=="S"||$status=="R"){
|
||||
$r['status'] = 1;
|
||||
}elseif($status=="Z"){
|
||||
$r['status'] = 2;
|
||||
}else{
|
||||
$r['status'] = 0;
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function removeEmptyValues($ar)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue