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