Files
serverconfig/scripts/common.sh
Loïc GUEZO 1984b4fe70 feat: finish install scripts
all .sh scripts -> /usr/local/bin/
all .yml / .env -> /etc/serverconfig/

add [y/n] to override information
add --true argument to ignore [y/n] input
2025-06-17 22:34:57 +02:00

17 lines
337 B
Bash

#!/bin/bash
FILENAME="serverconfig"
ETC_DIR="/etc/$FILENAME"
ENV_FILE="$ENV_DIR/.env"
LOG="/var/log/$FILENAME.log"
DATETIME_FORMAT="%d-%m-%Y %H:%M:%S"
datetime_print() {
local message="$1"
local level="${2:-INFO}"
local timestamp="[$(date +"$DATETIME_FORMAT")]"
echo "$timestamp - $level: $message" | tee -a "$LOG"
}