• /dev/tcp check for data?

    From Rick Christian@1:2320/100 to All on Mon Apr 10 09:42:03 2017

    Hello everybody!

    I have a script which I use to poll some data via the kernel /dev/tcp setup...

    At times this can have an issue and data stops coming in....

    Is there some way am I just not finding to do sort of a "heartbeat" type thing...

    I do something like:

    exec 6<>/dev/tcp/ip/port

    Then I do a

    while read <&6

    Then it breaks down that data to stuff I need...a do case case scenario... pretty much there data is 24/7/365 with stops for legit reasons... but its the none legit data cessation ie: the remote connection got snafu'd what ever.. I need to test for, and restart...or what not.

    what I am not coming up with is a way to check if read didn't get any data in say x seconds.. do something else.. like an alert or something...

    This is done in BASH... right now since this is complete other than this little

    data check I don't want to rewrite it in somthing else... I played with doing some work with it in Python 2.7.x but for right now I would like to stick to BASH....

    What numbingly simple thing am I missing here....

    Thanks!


    Rick


    ... Ding Dong the Witch is DEAD! I Made America Great Again! President Trump! --- GoldED+/LNX 1.1.5-b20161221
    # Origin: Vina's Talos Moon Base Alpha (1:135/377)
    * Origin: LiveWire BBS - Synchronet - LiveWireBBS.com (1:2320/100)