-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdomain-logs.sh
More file actions
62 lines (52 loc) · 2.79 KB
/
domain-logs.sh
File metadata and controls
62 lines (52 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
#----------------------------------------------------------------------------------
# EngineScript - A High-Performance WordPress Server Built on Ubuntu and Cloudflare
#----------------------------------------------------------------------------------
# Website: https://EngineScript.com
# GitHub: https://github.com/Enginescript/EngineScript
# License: GPL v3.0
#----------------------------------------------------------------------------------
# EngineScript Variables
source /usr/local/bin/enginescript/enginescript-variables.txt || { echo "Error: Failed to source /usr/local/bin/enginescript/enginescript-variables.txt" >&2; exit 1; }
source /home/EngineScript/enginescript-install-options.txt || { echo "Error: Failed to source /home/EngineScript/enginescript-install-options.txt" >&2; exit 1; }
# Source shared functions library
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh || { echo "Error: Failed to source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh" >&2; exit 1; }
#----------------------------------------------------------------------------------
# Start Main Script
cd /var/www/sites
printf "Please select the site you want to view logs for:\n"
select d in *; do test -n "$d" && break; echo ">>> Invalid Selection"; done
# Domain Nginx error log
echo "${BOLD}Showing last 20 lines of Nginx error log for ${d}.${NORMAL}" | boxes -a c -d shell -p a1l2
if [[ -f "/var/log/domains/${d}/${d}-nginx-error.log" ]]; then
tail -n20 "/var/log/domains/${d}/${d}-nginx-error.log"
else
echo "Log file not found: /var/log/domains/${d}/${d}-nginx-error.log"
fi
# WordPress error log
echo "${BOLD}Showing last 20 lines of WordPress error log for ${d}.${NORMAL}" | boxes -a c -d shell -p a1l2
if [[ -f "/var/log/domains/${d}/${d}-wp-error.log" ]]; then
tail -n20 "/var/log/domains/${d}/${d}-wp-error.log"
else
echo "Log file not found: /var/log/domains/${d}/${d}-wp-error.log"
fi
# Admin Control Panel access log (for security auditing)
echo "${BOLD}Showing last 20 lines of Admin Control Panel access log for ${d}.${NORMAL}" | boxes -a c -d shell -p a1l2
if [[ -f "/var/log/domains/admin.${d}-nginx-access.log" ]]; then
tail -n20 "/var/log/domains/admin.${d}-nginx-access.log"
else
echo "Log file not found: /var/log/domains/admin.${d}-nginx-access.log"
fi
# Admin Control Panel error log
echo "${BOLD}Showing last 20 lines of Admin Control Panel error log for ${d}.${NORMAL}" | boxes -a c -d shell -p a1l2
if [[ -f "/var/log/domains/admin.${d}-nginx-error.log" ]]; then
tail -n20 "/var/log/domains/admin.${d}-nginx-error.log"
else
echo "Log file not found: /var/log/domains/admin.${d}-nginx-error.log"
fi
# Ask user to acknowledge before continuing
echo ""
echo ""
read -n 1 -s -r -p "Press any key to continue"
echo ""
echo ""