[CentOS] CentOS 7 bash perhaps off topic

KM info4km at yahoo.com
Mon Nov 26 20:19:42 UTC 2018


 So you are saying that the actual "while read line do ….. done …." is what is failing?Try sending the output of the smwebsocket "$URL" | grep Location so we may see what is being passed to the while read line.
Additionally you could use sh -x to execute it and it may show something.
You could send the code exactly also.K
    On ‎Monday‎, ‎November‎ ‎26‎, ‎2018‎ ‎03‎:‎11‎:‎14‎ ‎PM‎ ‎EST, Jerry Geis <jerry.geis at gmail.com> wrote:  
 
 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
  


More information about the CentOS mailing list