Re: CentOS 7 bash perhaps off topic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



 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@xxxxxxxxx> 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@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos
  
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux