Networking and file transfer
Applies to: Rubian 4.0.2; host tools and connected network features have separate requirements
Updated
Rubian provides commands for connection checks, host network inspection, SSH access and file transfer. Host utilities use the host's network configuration and credentials. Connected network commands require an authenticated Rubian environment with the corresponding features.
Check a destination#
observation = ping('example.com', count: 4)
ping uses the host's ICMP utility. It returns a summary containing the destination, sent and received counts, loss percentage and, when available, average round-trip time. Parsing depends on the host utility's output. A host that blocks ICMP can still provide a working application service.
For configured TCP services:
multi_ping(['host-a.example', 'host-b.example'], port: 443, probe_timeout: 2.0)
Replace the example destinations with systems you operate or are evaluating. multi_ping, also named mping, probes the selected TCP port and returns results by host. It is a service-port check rather than ICMP ping. A successful connection does not verify TLS, credentials or application behavior.
net_tcp_ping(host, port) provides a connected-environment TCP check and returns a result with an ok field or an error. net_stats reports the available TCP/UDP observations. The optional net_udp_echo and net_selftest are local network checks that open sockets and exchange test messages; passing them does not establish remote-service reachability.
Inspect host networking#
| Command | Purpose |
|---|---|
ip('addr') |
Display host addresses through the installed ip utility. |
ip('route') |
Display host routes. |
iconfig / iconfig(:brief) |
Display host interface information using available host tools. |
netstat(mode: :listening) |
Display listening host sockets. Other supported modes include :established and :all. |
These examples inspect configuration. Other arguments accepted by host utilities can change it. Check the host and interface before making a network change, especially over a remote session.
Open an SSH session#
ssh('server.example', user: 'operator', port: 22, key: '/path/to/key')
ssh(target, user: nil, port: 22, key: nil) opens the host SSH client. The target can contain a username; an explicit user selects the requested account. Omit key to use the client's configured authentication. Verify host identity using your organization's SSH procedure. Authentication and interactive input belong to the host client.
Transfer host files#
scp('/path/to/report.txt', 'operator@server.example:/path/to/reports/')
rsync('/path/to/project/', 'operator@server.example:/path/to/project/', '-avn')
The SCP example copies one file. scp('-r', source, destination) supports a recursive copy. The wrapper accepts leading flags, but not every option with a separate argument is handled; use the host client directly for more complex option sets.
The rsync example requests a dry run. Review its output before repeating it with the intended copying options. Rubian's default rsync options are -avz; an explicit final option string replaces them. A source directory's trailing slash affects what is copied according to rsync's rules.
These commands transfer host files. They do not automatically export Rubian-managed files. Returned host-command status and displayed output should be checked together; verify the destination when completeness matters.
Retrieve an HTTP resource#
curl(*arguments) runs the host curl client. wget(*arguments, output: nil) runs the host wget client, optionally selecting a local output file. They display the host tool's output and do not return an HTTP response object for Ruby composition.
curl('--head', 'https://example.com')
This requests response headers. Use explicit output destinations for downloads and inspect downloaded content before executing it. Keep credentials in the host client's approved credential mechanism rather than command-history arguments.
For a failed transfer, retain the host-tool exit result and error, destination, timestamp and selected account. Distinguish name resolution, connection, authentication, permission and application errors before retrying.