mirror of
https://github.com/guezoloic/serverconfig.git
synced 2026-01-25 09:34:23 +00:00
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
17 lines
337 B
Bash
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"
|
|
} |