34 lines
967 B
Bash
34 lines
967 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Example script using shared modules
|
||
|
|
# Demonstrates how to use the modular approach
|
||
|
|
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Load shared modules
|
||
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
source "$SCRIPT_DIR/lib/ip-config.sh"
|
||
|
|
source "$SCRIPT_DIR/lib/logging.sh"
|
||
|
|
source "$SCRIPT_DIR/lib/proxmox-api.sh"
|
||
|
|
source "$SCRIPT_DIR/lib/ssh-helpers.sh"
|
||
|
|
|
||
|
|
# Now you can use:
|
||
|
|
# - IP variables: $PROXMOX_HOST_ML110, $IP_BLOCKSCOUT, etc.
|
||
|
|
# - Logging functions: log_info, log_success, log_error, etc.
|
||
|
|
# - Proxmox API: proxmox_api_call, check_container_status, etc.
|
||
|
|
# - SSH helpers: ssh_proxmox, ssh_container, test_ssh_connection
|
||
|
|
|
||
|
|
log_header "Example Script Using Modules"
|
||
|
|
|
||
|
|
log_info "Proxmox Host: $PROXMOX_HOST_ML110"
|
||
|
|
log_info "Blockscout IP: $IP_BLOCKSCOUT"
|
||
|
|
|
||
|
|
# Test SSH connection
|
||
|
|
if test_ssh_connection "$PROXMOX_HOST_ML110"; then
|
||
|
|
log_success "Connection test passed"
|
||
|
|
else
|
||
|
|
log_error "Connection test failed"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
log_success "Example complete!"
|