Question

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.

Was it helpful?

Solution

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top