[CentOS] CentOS 7 bash perhaps off topic

Jerry Geis

jerry.geis at gmail.com
Mon Nov 26 20:11:32 UTC 2018


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



More information about the CentOS mailing list