Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6538835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:47:02+00:00 2026-05-25T10:47:02+00:00

So I have multiple processes running: N amount of working threads and 1 collector

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:47:02+00:00Added an answer on May 25, 2026 at 10:47 am

    Ah.. durp. Forgot I could just run that into a variable in php and sub string it….

    Solution:

    exec("pgrep php | xargs ps", $result, $r2);
    $found = false;
    foreach($result as $r){
        if(strstr($r, 'twitterbot-collector')){
            $found = true;
        } 
    }
    
    if(!$found){
        system("php /var/www/robot/twitterbot-collector.php > /dev/null 2>/dev/null &");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple processes monitoring an MSMQ queue. I want to do multi-step operations
Here's what I am working on. At my website I have multiple processes with
I have several processes running concurrently that I want to log to the same
I often have multiple processes running (R, Python, eshell/shell), and for each I often
I have multiple python processes running in their console output windows. I can set
If have I have multiple processes accessing a registry value thousands of times per
A single Biztalk Server can have multiple Host processes. Is it possible to create
I have a Django project in which multiple processes are accessing the backend mysql
I have an application where there are multiple processes. They share the reading and
We have a weblogic batch application which processes multiple requests from consumers at the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.