So I have multiple processes running: N amount of working threads and 1 collector thread.
I want to determine ONLY if the collector thread is active.
These are the command results from pgrep php | xargs ps
PID TTY STAT TIME COMMAND
1682 ? S 0:00 php /var/www/robot/twitterbot.php -t tokenstring -s tokensecretstring
3744 ? S 0:00 php /var/www/robot/twitterbot.php -t tokenstring -s tokensecretstring
4972 ? S 0:00 php /var/www/robot/twitterbot.php -t tokenstring -s tokensecretstring
5215 pts/0 S 0:00 php twitterbot-collector.php
I want to be able to just determine if the collector is running. How can i achieve this?
I plan to have a cron job checking this every few minutes and then executing the script if it dies.
Ah.. durp. Forgot I could just run that into a variable in php and sub string it….
Solution: