[CentOS] CentOS 7 bash perhaps off topic

Mon Nov 26 20:46:00 UTC 2018
Leroy Tennison <leroy at datavoiceint.com>

If I'm understanding you corectly, you want smwebsocket to continuously pull data passing it to grep for filtering and ultimately to myprogram to update a database.  If that's correct I haven't had an opportunity to work with that but my current understanding of how pipelining works is that smwebsocket would retrieve $URL (which would be a finite amount of data), it would end sending output to grep which would filter it (and end) sending its output to the while loop around myprogram which would process it until there was no more data (and end) thus landing at 'sleep 60' only to start over again.  If a pipeline is capable of continuous processing I'm not aware of it (but would be glad to know that's how it can work).


Leroy Tennison
Network Information/Cyber Security Specialist
E: leroy at datavoiceint.com
2220 Bush Dr
McKinney, Texas
75070
www.datavoiceint.com
TThis message has been sent on behalf
of a company that is part of the Harris Operating Group of
Constellation Software Inc. These companies are listed
here
.
If you prefer not to be contacted by Harris
Operating Group
please notify us
.
This message is intended exclusively for the
individual or entity to which it is addressed. This communication
may contain information that is proprietary, privileged or
confidential or otherwise legally exempt from disclosure. If you are
not the named addressee, you are not authorized to read, print,
retain, copy or disseminate this message or any part of it. If you
have received this message in error, please notify the sender
immediately by e-mail and delete all copies of the
message.

________________________________________
From: CentOS <centos-bounces at centos.org> on behalf of Jerry Geis <jerry.geis at gmail.com>
Sent: Monday, November 26, 2018 2:11 PM
To: CentOS mailing list
Subject: [EXTERNAL] [CentOS] CentOS 7 bash perhaps off topic

hi all,

I have a small script that seems to be exiting and hitting the sleep 60...
The smwebsocket just connects to the web socket provided and outputs the
data. This works manually.

the myprogram just opens a database and writes the line...

My desire is to run the smwebsocket, connect to the websocket and output
the data (line by line) when we get a line that matches Location take that
line and output to the database. Seems simple. I desire this to keep the
connection alive and just continue to read data and grep on the data etc...
if smwebsocket does exit, sleep 60 and reconnect.

However it seems to be exiting and running the sleep 60. Am I missing
something ?

while [ 1 ]
                do
                        smwebsocket "$URL" | grep Location | while read line
                        do
                                myprogram -data "$line"
                        done

                sleep 60
                Reconnecting...
                done

All the pieces work - just not the actual running.  What am I missing?

Jerry
_______________________________________________
CentOS mailing list
CentOS at centos.org
https://lists.centos.org/mailman/listinfo/centos