TABLE OF CONTENTS


::pwtk::host_is_up

SYNOPSIS

proc ::pwtk::host_is_up {user_at_host} {

PURPOSE

Check with the 'ping' program if the remote host is up. If the 'ping' program is missing, ::pwtk::can_connect is used instead.

ARGUMENT

RETURN VALUE

SOURCE

    if { [getExecutable ping] ne {} } {
        set host [resolve_ssh_alias $user_at_host]
        if { [catch {exec ping -c 1 $host}] } {
            return 0
        } else {
            return 1
        }
    } else {
        pwtk::warning "ping program not found, using ssh instead"
        return [can_connect $user_at_host]
    }
}