I would like to constantly check the table in the database to execute the commands. Some teams may take 4 minutes, and after 10 seconds.
Therefore, I would like to run them in threads. Thus, each record creates a new stream, and after creating the stream, the record is deleted.
Since the DB + search will create a stream in an endless loop, how do I get a response from a stream (the stream will issue a shell command and get a response code that I would like to read)?
I was thinking about creating two threads with an infinite loop: - first, to search for the database + create new threads - the second for ... somehow reading the results of the threads and the actions for each answer
Or maybe I should use fork or os to create a new process?
source
share