mirror of
https://github.com/kossakovsky/n8n-install.git
synced 2026-03-08 06:43:22 +00:00
- Introduced a series of scripts to automate system preparation, Docker installation, secret generation, service execution, and final reporting. - Implemented logging functions for better visibility during script execution. - Ensured checks for required files and user inputs to enhance robustness. - Added functionality for managing Docker services and generating a comprehensive installation summary.
52 lines
1.3 KiB
Bash
52 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
# Logging function that frames a message with a border and adds a timestamp
|
|
log_message() {
|
|
local message="$1"
|
|
local combined_message="${message}"
|
|
local length=${#combined_message}
|
|
local border_length=$((length + 4))
|
|
|
|
# Create the top border
|
|
local border=""
|
|
for ((i=0; i<border_length; i++)); do
|
|
border="${border}─"
|
|
done
|
|
|
|
# Display the framed message with timestamp
|
|
echo "╭${border}╮"
|
|
echo "│ ${combined_message} │"
|
|
echo "╰${border}╯"
|
|
}
|
|
|
|
# Example usage:
|
|
# log_message "This is a test message"
|
|
|
|
log_success() {
|
|
local message="$1"
|
|
local timestamp=$(date +%H:%M:%S)
|
|
local combined_message="[SUCCESS] ${timestamp}: ${message}"
|
|
log_message "${combined_message}"
|
|
}
|
|
|
|
log_error() {
|
|
local message="$1"
|
|
local timestamp=$(date +%H:%M:%S)
|
|
local combined_message="[ERROR] ${timestamp}: ${message}"
|
|
log_message "${combined_message}"
|
|
}
|
|
|
|
log_warning() {
|
|
local message="$1"
|
|
local timestamp=$(date +%H:%M:%S)
|
|
local combined_message="[WARNING] ${timestamp}: ${message}"
|
|
log_message "${combined_message}"
|
|
}
|
|
|
|
log_info() {
|
|
local message="$1"
|
|
local timestamp=$(date +%H:%M:%S)
|
|
local combined_message="[INFO] ${timestamp}: ${message}"
|
|
log_message "${combined_message}"
|
|
}
|