I want to read the console logs of a process that is running, I currently have this

$output = shell_exec('pgrep tfs');
echo "<pre>$output</pre>";

And that returns me a random number like 34034

I've almost never worked with linux before so I dont really know how to do this.

有帮助吗?

解决方案

You do realize that that's what pgrep does, right? It returns the process ID of the process you're asking about. So that's not a random number you're getting back. Your script is working perfectly.

Why don't you find the actual log file itself (usually in /var/logs) and use something like fopen to open and parse it?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top