-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_suite
More file actions
58 lines (50 loc) · 1.84 KB
/
verify_suite
File metadata and controls
58 lines (50 loc) · 1.84 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
#!/bin/bash
# sysadmin/verify_suite
# Source common from the same directory as the script
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
source "$SCRIPT_DIR/common"
# Colors (already in common, but keeping here for standalone run if needed)
# Actually, common already has them.
echo -e "${YELLOW}=== SysAdmin Suite Health Check ===${NC}\n"
# 1. Check Directory Structure
for dir in "$SYSADMIN_DIR" "$MODULES_DIR"; do
if [ -d "$dir" ]; then
echo -e "[${GREEN}OK${NC}] Directory found: $dir"
else
echo -e "[${RED}FAIL${NC}] Directory missing: $dir"
fi
done
# 2. Check Core Files
files=("sysadmin" "common")
for f in "${files[@]}"; do
if [ -f "$SYSADMIN_DIR/$f" ]; then
if [[ "$f" == "sysadmin" && ! -x "$SYSADMIN_DIR/$f" ]]; then
echo -e "[${RED}WARN${NC}] $f exists but is NOT executable."
else
echo -e "[${GREEN}OK${NC}] File found: $SYSADMIN_DIR/$f"
fi
else
echo -e "[${RED}FAIL${NC}] File missing: $SYSADMIN_DIR/$f"
fi
done
# 3. Check Modules
modules=("certbot_mgr" "db_mgr" "f2b_mgr" "help_mgr" "miniflux_mgr" "nextcloud_mgr" "nginx_mgr" "redis_mgr" "system_mgr" "ufw_mgr")
for m in "${modules[@]}"; do
if [ -f "$MODULES_DIR/$m" ]; then
if [ -x "$MODULES_DIR/$m" ]; then
echo -e "[${GREEN}OK${NC}] Module found & executable: $m"
else
echo -e "[${YELLOW}FIX${NC}] $m is not executable. Running chmod +x..."
chmod +x "$MODULES_DIR/$m"
fi
else
echo -e "[${RED}MISSING${NC}] Module file not found: $m"
fi
done
# 4. Check Logging
if [ -f "$LOG_FILE" ]; then
echo -e "[${GREEN}OK${NC}] Log file found: $LOG_FILE"
else
echo -e "[${YELLOW}INFO${NC}] Log file not yet created (this is normal if no actions have been run)."
fi
echo -e "\n${YELLOW}Health check complete.${NC}"