diff --git a/.gitignore b/.gitignore index 92fafc5..ef8aea6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ caddy/* -wordpress/* \ No newline at end of file +wordpress/* +kazewp.log \ No newline at end of file diff --git a/kazewp.sh b/kazewp.sh index eef8856..f1a439d 100755 --- a/kazewp.sh +++ b/kazewp.sh @@ -1,5 +1,9 @@ #!/bin/bash +LOG_FILE="kazewp.log" +exec > >(tee -a "$LOG_FILE") 2>&1 +echo -e "\n========== $(date '+%Y-%m-%d %H:%M:%S') ==========" + # Get the directory where the script is located SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" diff --git a/lib/colors.sh b/lib/colors.sh index 8cc32cb..563fc88 100644 --- a/lib/colors.sh +++ b/lib/colors.sh @@ -1,4 +1,13 @@ -RED='\033[0;31m' -GREEN='\033[0;32m' -BLUE='\033[0;34m' -NC='\033[0m' # No Color \ No newline at end of file +if [ -t 1 ]; then + # Terminal supports colors + NC='\033[0m' # No Color + RED='\033[0;31m' + GREEN='\033[0;32m' + BLUE='\033[0;34m' +else + # Disable colors for non-terminal outputs (like logs) + NC='' + RED='' + GREEN='' + BLUE='' +fi \ No newline at end of file