This is really embarrassing. Around the middle of August I posted a script that worked but just barely. Rpural was good enough to show me how this could be implemented much more elegantly.

#!/bin/bash -x

# See if the application in question is running and dump output into a text file
GKRELLM=$(ps aux|grep gkrellm)
# instead of using a temporary file, dump the output into a variable

# Define some variables representing the ip addresses of the machines I'm testing for

check() {
        # Check the text file for presence of the ip addresses expected.
        # If present, move on, else, open up a gkrellm instance for that ip address.
        # Do this for each ip address I'm looking for.
        echo $GKRELLM | grep -Fq "$1"                                                                                                                                        
        if [ $? -eq 0 ]                                                                                                                                                      
        then echo "found $1 $2"                  # If so, move on, if not start a gkrellm instance                                                                           
        else ssh -p2222 -f -L 19150:${1}:19150 $1 "gkrellm -f -s -P 19150"                                                                                         
check $ADAMSMDK ADAMSMDK                                                                                                                                                     
check $PVR PVR                                                                                                                                                               
check $SHUTTLE SHUTTLE                                                                                                                                                       
This works beautifully, but it has a strange side effect. When I run that script it opens gkrellm for the named servers, then it opens a dialog for my password to one of the machines's gkrellm server.

I feed it my password and it opens a second instance of the Gkrellm meter without the expected configuration.

The thing is, for the life of me, I can't figure out what's going on here. Why just that one meter? What's special about that? The configuration for that machine and the Gkrellm server on it is exactly like all the rest, as near as I can tell. I can't even figure out how to troubleshoot this.

Any ideas?

Thanks in advance.