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
- user_at_host -- name of the remote host (can be in the form of user@host)
RETURN VALUE
- 1 ... if the host is up
- 0 ... if the host is down
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] } }