Hawknskola
Hawknskola

Reputation: 99

PHP Webdriver - Get Firefox PID in Linux / Windows

Good morning all,

PHP Webdriver (Facebook) - Is there any way I can get the PID (Linux, Centos 7) of the currently lunched browser (Firefox) during the session?

Upvotes: 0

Views: 223

Answers (2)

Anubis
Anubis

Reputation: 7445

ps command takes a lot of input arguments. With --format and --sort you can find the processes with their durations and sort them by the duration.

ps -ef --format=pid,cmd,time --sort=time | grep firefox

You can filter this out further and develop a script to kill the firefox processes with the duration higher than a given value.

Upvotes: 0

Samy
Samy

Reputation: 649

Sure, it's as simple as pidof firefox.

Upvotes: 0

Related Questions