I’m running a command in my linux server (Ubuntu).
For example:
screen -A -h 1500 -m -dmS test_command_one /home/SKY-users/SKY-001/./script
Is there any way to the PID of this background progress which screen name is: test_command_one?
ps aux | grep test_command_one:
root 6573 8.1 2.4 271688 123804 pts/4 Ss+ Oct19 3:04 /home/SKY-users/SKY-001/./ ...
I’d like to get back this PID: 6573
PHP: (easy)
<?php
$output = shell_exec('sudo ps aux | grep test_command_one');
$array = explode("\n", $output);
echo '<pre>'.print_r($array, true).'</pre>';
?>
Thanks for help!
Edit:
By combining with code by @WagnerVaz
Explanation