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

Re: [hobbit] Using ssh to retrieve hobbit data



On 1/4/06, Henrik Stoerner <henrik (at) hswn.dk> wrote:
>    [snip]
>
> This is a rough solution. It doesn't deal with scp taking a loooooong
> time to login or timeout if your client is down; it doesn't delete the
> client-side status message, so if you client stops running you won't
> notice it going purple. But it should give you an idea of how it can
> be done, and it would work for the common case.

bb-fetch.sh doesn't delete the client-side status message either.  It
keeps the old copy and diffs the new copy against it.  If there's no
difference, the client-side isn't updating.  So, your rough solution
would become something along the lines of:

         # Save the old statusfile and get the new one
        mv $HOSTNAME.$MSGFILE $HOSTNAME.$MSGFILE.old
        scp hobbit (at) $HOSTNAME:client/tmp/msg.txt $HOSTNAME.$MSGFILE
        if [ -f $HOSTNAME.$MSGFILE.old ]; then
            changed=`$DIFF $HOSTNAME.$MSGFILE $HOSTNAME.$MSGFILE.old`
        else
            changed="new"
        fi

        if [ "$changed" = "" ]; then
             # report that the client isn't updating
        fi

Perhaps scp options ConnectionAttempts & ConnectTimeout would help
deal with the long login timeout??

Ralph Mitchell