Exemplo n.º 1
0
                                            /* ACTION: View log file. Must have debug and log to file enabled, and sufficient perms 
                                             * Parms: [lines] */
                                            if (!canEdit('System')) {
                                                logXmlErr("Insufficient permissions to view log file");
                                                echo "Insufficient permissions to view log file";
                                                exit;
                                            }
                                            if (!ZM_EYEZM_DEBUG || !ZM_EYEZM_LOG_TO_FILE) {
                                                echo "eyeZm Debug (EYEZM_DEBUG) or log-to-file (EYEZM_LOG_TO_FILE) not enabled. Please enable first";
                                                exit;
                                            }
                                            if (!file_exists(ZM_EYEZM_LOG_FILE)) {
                                                echo "Log file " . ZM_EYEZM_LOG_FILE . " doesn't exist";
                                                exit;
                                            }
                                            $lines = validInteger(getset('lines', ZM_EYEZM_LOG_LINES));
                                            logXml("Returning last " . $lines . " lines of eyeZm Log from " . ZM_EYEZM_LOG_FILE);
                                            echo shell_exec("tail -n " . $lines . " " . ZM_EYEZM_LOG_FILE);
                                            echo "\n\n--- Showing last " . $lines . " lines ---\n";
                                            echo "--- End of Log ---\n\n";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 2
0
function kill264proc($monitor)
{
    /** NOTE: This command executes an 'kill' command, so $monitor parameter
     * should be properly validated before executing */
    $pid = trim(shell_exec("pgrep -f -x \"zmstreamer -m " . $monitor . "\""));
    if ($pid == "") {
        logXml("No PID found for ZMStreamer to kill");
    } else {
        shell_exec("kill -9 " . $pid);
        logXml("Killed process " . $pid . " for Monitor " . $monitor);
    }
}