mirror of
https://github.com/guezoloic/serverconfig.git
synced 2026-01-25 10:34:23 +00:00
feat: add common.sh file and initialize install.sh
This commit is contained in:
12
install.sh
12
install.sh
@@ -1 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
source "./scripts/common.sh"
|
||||||
|
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo "the script needs to be as root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if [ ! -d "$ENV_DIR" ]; then
|
||||||
|
# echo "$ENV_DIR is missing..., "
|
||||||
|
# mkdir -p $ENV_DIR
|
||||||
|
# fi
|
||||||
17
scripts/common.sh
Normal file
17
scripts/common.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
FILENAME="serverconfig"
|
||||||
|
|
||||||
|
ENV_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"
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
volumes:
|
volumes:
|
||||||
etc_wireguard:
|
etc_wireguard:
|
||||||
etc_certs:
|
etc_certs:
|
||||||
|
# save certifcate
|
||||||
etc_acme:
|
etc_acme:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|||||||
Reference in New Issue
Block a user