F
F
fokin_nikolay19892016-11-10 11:07:08
bash
fokin_nikolay1989, 2016-11-10 11:07:08

How to write a condition that would be true until the connection falls off BASH?

Good day, guys, tell me how to write the correct condition so that it is fulfilled until all connections from the user fall off on BASH
Here is the output of the connections
# ps aux | grep rdb_inet
firebird 10057 0.4 0.1 481164 262752 ? Ssl 07:29 0:52 /opt/RedDatabase/bin/rdb_inet_server
firebird 11343 0.5 0.1 384848 171916 ? Ssl 08:19 0:51 /opt/RedDatabase/bin/rdb_inet_server
root 19387 0.0 0.0 103384 848 pts/0 S+ 11:01 0:00 grep rdb_inet
if there is a connection from the firebird user, then
/opt/RedDatabase/bin should be executed /isql ncore-db -i /home/scripts/rdb_inet pkill
-15 -f rdb_inet
if there are no processes from the firebird user and, accordingly, only
root 19387 0.0 0.0 103384 848 pts/0 S+ 11:01 0:00 grep rdb_inet,
then go to the next step
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
3
3vi1_0n3, 2017-01-21
@3vi1_0n3

The question is not fresh, however, something like this:

while :
do
  COUNT=$(pgrep aux | grep rdb_inet | grep ^firebird | wc -l)
  if [ "$COUNT" != "0" ]
  then
    pkill -15 -f rdb_inet
    continue
  else
    break
  fi
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question