TABLE OF CONTENTS


::pwtk::remote_pidwait

SYNOPSIS

proc ::pwtk::remote_pidwait {user_at_host PID} {

PURPOSE

Wait for the process, running on the remote host with PID, to finish.

ARGUMENTS

SOURCE

    variable remote

    set host [rhost_ $user_at_host]
    
    # check if host is alive and user can connect to it
    while { ! [can_connect $user_at_host] } {
        incr attempts
        print "from [procName]: host '$host' is down (attempt #$attempts)"
        
        after $remote(time_interval_ms)
        
        if { $remote(max_attempts) > 0 && $attempts > $remote(max_attempts) } {
            ::pwtk::error "failed to connect to $host in $attempts attempts" 1
        }
    }

    # wait while remote PID is alive
    while { [remote_pidexists $user_at_host $PID] } {
        after $remote(time_interval_ms)
    }
}