Skip to content

Commit 42ab725

Browse files
updatE
1 parent f5d58da commit 42ab725

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

bin/lamp-check

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
HOST="127.0.0.1"
44
PORT="8080"
55

6+
COLOR_DEFAULT="\e[39m"
7+
COLOR_RESET="\033[0m"
8+
COLOR_BASED="\e[39m"
9+
COLOR_DANGER="\e[91m"
10+
COLOR_WARNING="\e[93m"
11+
COLOR_SUCCESS="\e[92m"
12+
COLOR_SKY="\e[34m"
13+
614
response() {
715

816
PROTOCOL=`curl -I ${1} 2> /dev/null | sed -n 1p | awk '{printf $1}'`
@@ -11,32 +19,29 @@ response() {
1119
CONTENT=`curl -I ${1} 2> /dev/null | grep Content-Type: | awk '{printf $2" "$3}'`
1220

1321
echo -e "
14-
╭─ LAMP CHECK ──────────────────────────────────────────"
15-
echo -e " "
22+
╭─ LAMP CHECK ───────────────────────────────────╮"
23+
echo -e " │ │"
1624

17-
echo -e " │ Request URL: http://${HOST}:${PORT} "
18-
echo -e " "
19-
printf " │ %-10s %-8s %-29s │\n" "PATH" "Header" "Value"
20-
printf " │ %-10s %-8s %-29s │\n" "──────────" "────────" "─────────────────────────────"
21-
echo -e " "
25+
echo -e " │ Request URL: http://${HOST}:${PORT}"
26+
echo -e " │ │"
27+
printf " │ %-11s %-8s %-21s │\n" "PATH" "Header" "Value"
28+
printf " │ %-11s %-8s %-20s │\n" "──────────" "────────" "─────────────────────"
29+
echo -e " │ │"
2230

23-
printf " │ %-11s %-8s %-29s │\n" ${2} "Protocol" ${PROTOCOL}
31+
printf " │ %-11s %-8s %-21s │\n" ${2} "Protocol" ${PROTOCOL}
2432

2533
if [ ${STATUS} == "200" ]; then
26-
printf " │ %-10s %-8s %-31s│\n" "" "Status" "${STATUS} OK"
34+
printf " │ %-10s %-8s ${COLOR_SUCCESS}%-23s${COLOR_DEFAULT}│\n" "" "Status" "${STATUS} OK"
2735
elif [ ${STATUS} == "301" ]; then
28-
printf " │ %-10s %-8s %-31s│\n" "" "Status" "${STATUS} Moved Permanently"
36+
printf " │ %-10s %-8s ${COLOR_SUCCESS}%-23s${COLOR_DEFAULT}│\n" "" "Status" "${STATUS} Moved Permanently"
2937
elif [ ${STATUS} == "403" ]; then
30-
printf " │ %-10s %-8s %-31s│\n" "" "Status" "${STATUS} Forbidden"
38+
printf " │ %-10s %-8s ${COLOR_DANGER}%-23s${COLOR_DEFAULT}│\n" "" "Status" "${STATUS} Forbidden"
3139
fi
3240

33-
# printf " │ %-10s %-8s %b │\n" "" "Server" ${SERVER}
34-
echo -e " │ Server ${SERVER}"
35-
echo -e " │ Content ${CONTENT}"
36-
# printf " │ %-10s %-8s %-21s %-20s %-29s" ${2} ${PROTOCOL} ${STATUS} ${SERVER} ${CONTENT}
37-
echo -e " │ │"
38-
echo -e " ╰───────────────────────────────────────────────────────╯\n"
41+
echo -e " │ Server ${SERVER}"
42+
echo -e " │ │"
43+
echo -e " ╰────────────────────────────────────────────────╯\n"
3944
}
4045

41-
response "http://${HOST}:${PORT}/phpmyadmin" "/phpmyadmin"
42-
response "http://${HOST}:${PORT}" "/"
46+
response "${HOST}:${PORT}" "/"
47+
response "${HOST}:${PORT}/phpmyadmin" "/phpmyadmin"

0 commit comments

Comments
 (0)