v1.0.2: Îmbunătățiri diagnosticare - verificări detaliate config și permisiuni
- Adăugat verificări extinse în start_server() pentru permisiuni și citire config - Îmbunătățit test_config() cu diagnosticare detaliată - Creat script nou diagnose.sh pentru troubleshooting complet - Adăugat detectare probleme comune (permisiuni, acolade, ghilimele) - Îmbunătățit afișare erori cu soluții practice
This commit is contained in:
parent
f702a67b9c
commit
def00ffc01
245
admin.sh
245
admin.sh
|
|
@ -195,10 +195,13 @@ EOFCONFIG
|
|||
# Pornire server
|
||||
start_server() {
|
||||
echo -e "${VERDE}[+] Pornire server...${NC}"
|
||||
echo ""
|
||||
|
||||
# Verificări detaliate ale fișierului de configurare
|
||||
echo -e "${GALBEN}[*] Verificare fișier configurare...${NC}"
|
||||
|
||||
# Verifica dacă config există
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU}[-] Config nu găsit!${NC}"
|
||||
echo -e "${ROSU}[-] Config nu găsit la: $CONFIG_FILE${NC}"
|
||||
echo -e "${GALBEN}[!] Creează config cu admin.sh opțiune 5${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
|
|
@ -206,7 +209,47 @@ start_server() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
if ! [ -x "$IRCD_BIN" ]; then
|
||||
echo -e "${VERDE} ✓ Fișier există: $CONFIG_FILE${NC}"
|
||||
|
||||
# Verifică permisiuni de citire
|
||||
if [ ! -r "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU}[-] Fișier există dar nu poate fi citit!${NC}"
|
||||
echo -e "${GALBEN}[*] Permisiuni curente:${NC}"
|
||||
ls -la "$CONFIG_FILE"
|
||||
echo ""
|
||||
echo -e "${GALBEN}[!] Rulează: chmod 600 $CONFIG_FILE${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${VERDE} ✓ Permisiuni OK (poate fi citit)${NC}"
|
||||
|
||||
# Verifică dacă fișierul nu este gol
|
||||
if [ ! -s "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU}[-] Fișier de configurare este gol!${NC}"
|
||||
echo -e "${GALBEN}[!] Regenerează config cu admin.sh opțiune 5${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${VERDE} ✓ Fișier nu este gol ($(stat -f%z "$CONFIG_FILE" 2>/dev/null || stat -c%s "$CONFIG_FILE" 2>/dev/null) bytes)${NC}"
|
||||
|
||||
# Verifică directorul de log
|
||||
local log_dir=$(dirname "$LOG_FILE")
|
||||
if [ ! -d "$log_dir" ]; then
|
||||
echo -e "${GALBEN}[*] Creare director log: $log_dir${NC}"
|
||||
mkdir -p "$log_dir"
|
||||
fi
|
||||
|
||||
# Verifică executabilul
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Verificare executabil...${NC}"
|
||||
|
||||
if [ ! -f "$IRCD_BIN" ]; then
|
||||
echo -e "${ROSU}[-] Executabil ircd nu găsit la: $IRCD_BIN${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
|
|
@ -214,31 +257,95 @@ start_server() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# Verifica dacă e deja pornit
|
||||
if pgrep -f "$IRCD_BIN" > /dev/null; then
|
||||
echo -e "${ROSU}[-] Server deja pornit!${NC}"
|
||||
if ! [ -x "$IRCD_BIN" ]; then
|
||||
echo -e "${ROSU}[-] Executabil există dar nu are permisiuni de execuție!${NC}"
|
||||
echo -e "${GALBEN}[!] Rulează: chmod +x $IRCD_BIN${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Porneste server în background
|
||||
nohup "$IRCD_BIN" -f "$CONFIG_FILE" > "$LOG_FILE" 2>&1 &
|
||||
echo -e "${VERDE} ✓ Executabil OK: $IRCD_BIN${NC}"
|
||||
|
||||
# Verifica dacă e deja pornit
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Verificare proces existent...${NC}"
|
||||
if pgrep -f "$IRCD_BIN" > /dev/null; then
|
||||
echo -e "${ROSU}[-] Server deja pornit!${NC}"
|
||||
echo -e "${GALBEN}[*] PID: $(pgrep -f "$IRCD_BIN")${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${VERDE} ✓ Niciun proces activ${NC}"
|
||||
|
||||
# Porneste server în background
|
||||
echo ""
|
||||
echo -e "${VERDE}[+] Pornire server IRCd...${NC}"
|
||||
echo -e "${GALBEN}[*] Comandă: $IRCD_BIN -f $CONFIG_FILE${NC}"
|
||||
|
||||
nohup "$IRCD_BIN" -f "$CONFIG_FILE" > "$LOG_FILE" 2>&1 &
|
||||
local ircd_pid=$!
|
||||
|
||||
echo -e "${GALBEN}[*] Așteptare inițializare (2 secunde)...${NC}"
|
||||
sleep 2
|
||||
|
||||
# Verifică dacă procesul rulează
|
||||
if pgrep -f "$IRCD_BIN" > /dev/null; then
|
||||
echo -e "${VERDE}[+] Server pornit cu succes (PID: $(pgrep -f "$IRCD_BIN"))${NC}"
|
||||
echo ""
|
||||
echo -e "${VERDE}[+] ✓ Server pornit cu succes!${NC}"
|
||||
echo -e "${VERDE}[+] PID: $(pgrep -f "$IRCD_BIN")${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}Verificare rapidă log:${NC}"
|
||||
tail -5 "$LOG_FILE" | sed 's/^/ /'
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 0
|
||||
else
|
||||
echo -e "${ROSU}[-] Eșec la pornirea serverului!${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}Ultimele 10 rânduri din log:${NC}"
|
||||
tail -10 "$LOG_FILE"
|
||||
echo -e "${ROSU}[-] ✗ Eșec la pornirea serverului!${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}╔════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GALBEN}║ DIAGNOSTICARE EROARE ║${NC}"
|
||||
echo -e "${GALBEN}╚════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
|
||||
# Afișează ultimele 15 linii din log pentru context
|
||||
echo -e "${GALBEN}[*] Ultimele 15 rânduri din log:${NC}"
|
||||
echo -e "${GALBEN}────────────────────────────────────────${NC}"
|
||||
tail -15 "$LOG_FILE" 2>/dev/null || echo " (log-ul nu poate fi citit)"
|
||||
echo -e "${GALBEN}────────────────────────────────────────${NC}"
|
||||
|
||||
# Verificări suplimentare
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Verificări suplimentare:${NC}"
|
||||
|
||||
# Test sintaxă config
|
||||
echo -e "${GALBEN} → Test sintaxă configurare:${NC}"
|
||||
if "$IRCD_BIN" -c -f "$CONFIG_FILE" 2>&1 | head -5; then
|
||||
echo -e "${VERDE} Config pare valid${NC}"
|
||||
else
|
||||
echo -e "${ROSU} Erori în config detectate!${NC}"
|
||||
fi
|
||||
|
||||
# Verifică porturi
|
||||
echo ""
|
||||
echo -e "${GALBEN} → Porturi în uz pe sistem:${NC}"
|
||||
netstat -tuln 2>/dev/null | grep -E ":(6667|6697|4400)" || echo " (niciun conflict detectat)"
|
||||
|
||||
echo ""
|
||||
echo -e "${GALBEN}╔════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GALBEN}║ SOLUȚII POSIBILE: ║${NC}"
|
||||
echo -e "${GALBEN}╚════════════════════════════════════════╝${NC}"
|
||||
echo -e "${GALBEN}1. Verifică sintaxa config:${NC} ./admin.sh → opțiunea 8"
|
||||
echo -e "${GALBEN}2. Verifică permisiuni:${NC} ls -la $CONFIG_FILE"
|
||||
echo -e "${GALBEN}3. Verifică log complet:${NC} ./admin.sh → opțiunea 6"
|
||||
echo -e "${GALBEN}4. Regenerează config:${NC} ./admin.sh → opțiunea 5"
|
||||
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
|
|
@ -451,6 +558,10 @@ test_config() {
|
|||
echo -e "${VERDE}[+] Test sintaxă configurare...${NC}"
|
||||
echo ""
|
||||
|
||||
# Verificări preliminare
|
||||
echo -e "${GALBEN}[*] Verificări preliminare:${NC}"
|
||||
echo ""
|
||||
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU}[-] Fișier configurare nu găsit: $CONFIG_FILE${NC}"
|
||||
echo ""
|
||||
|
|
@ -459,28 +570,126 @@ test_config() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$IRCD_BIN" ]; then
|
||||
echo -e "${ROSU}[-] Executabil ircd nu găsit!${NC}"
|
||||
echo -e "${VERDE} ✓ Fișier există: $CONFIG_FILE${NC}"
|
||||
|
||||
# Verifică permisiuni
|
||||
if [ ! -r "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU} ✗ Fișier nu poate fi citit!${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Permisiuni actuale:${NC}"
|
||||
ls -la "$CONFIG_FILE"
|
||||
echo ""
|
||||
echo -e "${GALBEN}[!] Soluție: chmod 600 $CONFIG_FILE${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${GALBEN}Testare fișier: $CONFIG_FILE${NC}"
|
||||
echo -e "${VERDE} ✓ Permisiuni OK (citire posibilă)${NC}"
|
||||
|
||||
# Verifică mărime
|
||||
local file_size=$(stat -f%z "$CONFIG_FILE" 2>/dev/null || stat -c%s "$CONFIG_FILE" 2>/dev/null)
|
||||
if [ "$file_size" -eq 0 ]; then
|
||||
echo -e "${ROSU} ✗ Fișier este gol!${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}[!] Regenerează config cu opțiunea 5${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${VERDE} ✓ Mărime OK ($file_size bytes)${NC}"
|
||||
|
||||
# Verifică executabil
|
||||
if [ ! -x "$IRCD_BIN" ]; then
|
||||
echo -e "${ROSU} ✗ Executabil ircd nu găsit sau fără permisiuni!${NC}"
|
||||
echo -e "${GALBEN} Cale: $IRCD_BIN${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${VERDE} ✓ Executabil OK${NC}"
|
||||
|
||||
echo ""
|
||||
echo -e "${GALBEN}╔════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GALBEN}║ TEST SINTAXĂ CONFIGURARE ║${NC}"
|
||||
echo -e "${GALBEN}╚════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Rulare: $IRCD_BIN -c -f $CONFIG_FILE${NC}"
|
||||
echo -e "${GALBEN}────────────────────────────────────────${NC}"
|
||||
echo ""
|
||||
|
||||
if "$IRCD_BIN" -c -f "$CONFIG_FILE" 2>&1; then
|
||||
# Capturează output-ul testului
|
||||
local test_output=$("$IRCD_BIN" -c -f "$CONFIG_FILE" 2>&1)
|
||||
local test_result=$?
|
||||
|
||||
echo "$test_output"
|
||||
|
||||
echo ""
|
||||
echo -e "${GALBEN}────────────────────────────────────────${NC}"
|
||||
|
||||
if [ $test_result -eq 0 ]; then
|
||||
echo ""
|
||||
echo -e "${VERDE}[+] Configurare validă!${NC}"
|
||||
echo -e "${VERDE}╔════════════════════════════════════════╗${NC}"
|
||||
echo -e "${VERDE}║ ✓ CONFIGURARE VALIDĂ! ║${NC}"
|
||||
echo -e "${VERDE}╚════════════════════════════════════════╝${NC}"
|
||||
|
||||
# Statistici despre config
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Statistici configurare:${NC}"
|
||||
echo -e " Mărime fișier: $file_size bytes"
|
||||
echo -e " Linii total: $(wc -l < "$CONFIG_FILE")"
|
||||
echo -e " Blocuri General: $(grep -c "^General {" "$CONFIG_FILE" 2>/dev/null || echo 0)"
|
||||
echo -e " Blocuri Port: $(grep -c "^Port {" "$CONFIG_FILE" 2>/dev/null || echo 0)"
|
||||
echo -e " Blocuri Operator: $(grep -c "^Operator {" "$CONFIG_FILE" 2>/dev/null || echo 0)"
|
||||
echo -e " Blocuri Client: $(grep -c "^Client {" "$CONFIG_FILE" 2>/dev/null || echo 0)"
|
||||
|
||||
echo ""
|
||||
echo -e "${VERDE}[+] Serverul poate fi pornit cu această configurare!${NC}"
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 0
|
||||
else
|
||||
echo ""
|
||||
echo -e "${ROSU}[-] Erori în configurare detectate!${NC}"
|
||||
echo -e "${ROSU}╔════════════════════════════════════════╗${NC}"
|
||||
echo -e "${ROSU}║ ✗ ERORI ÎN CONFIGURARE! ║${NC}"
|
||||
echo -e "${ROSU}╚════════════════════════════════════════╝${NC}"
|
||||
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Soluții posibile:${NC}"
|
||||
echo -e " 1. Editează config: ./admin.sh → opțiunea 5"
|
||||
echo -e " 2. Verifică sintaxa manual: nano $CONFIG_FILE"
|
||||
echo -e " 3. Compară cu exemplu: cat doc/example.conf"
|
||||
echo -e " 4. Regenerează config nou"
|
||||
|
||||
echo ""
|
||||
echo -e "${GALBEN}[*] Verificări rapide:${NC}"
|
||||
|
||||
# Verifică ghilimele neînchise
|
||||
local unclosed_quotes=$(grep -n '"[^"]*$' "$CONFIG_FILE" | head -5)
|
||||
if [ -n "$unclosed_quotes" ]; then
|
||||
echo -e "${ROSU} ⚠ Posibil ghilimele neînchise:${NC}"
|
||||
echo "$unclosed_quotes" | sed 's/^/ /'
|
||||
fi
|
||||
|
||||
# Verifică acolade neînchise
|
||||
local open_braces=$(grep -o "{" "$CONFIG_FILE" | wc -l)
|
||||
local close_braces=$(grep -o "}" "$CONFIG_FILE" | wc -l)
|
||||
if [ "$open_braces" -ne "$close_braces" ]; then
|
||||
echo -e "${ROSU} ⚠ Acolade nepotrivite: { = $open_braces, } = $close_braces${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
echo -n "Apasa Enter pentru a continua..."
|
||||
read
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -0,0 +1,227 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script de diagnosticare pentru probleme UnderChat IRCd
|
||||
# Limba: Română
|
||||
#
|
||||
|
||||
# Culori
|
||||
VERDE='\033[0;32m'
|
||||
GALBEN='\033[1;33m'
|
||||
ALBASTRU='\033[0;34m'
|
||||
ROSU='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
PREFIX="${PREFIX:-$HOME/ircd}"
|
||||
IRCD_BIN="$PREFIX/bin/ircd"
|
||||
CONFIG_FILE="${PREFIX}/etc/ircd.conf"
|
||||
LOG_FILE="${PREFIX}/log/ircd.log"
|
||||
|
||||
echo -e "${ALBASTRU}"
|
||||
echo "╔════════════════════════════════════════╗"
|
||||
echo "║ Diagnosticare UnderChat IRCd ║"
|
||||
echo "║ Versiune: v1.0.2 ║"
|
||||
echo "╚════════════════════════════════════════╝"
|
||||
echo -e "${NC}"
|
||||
echo ""
|
||||
|
||||
# 1. Verificare fișier configurare
|
||||
echo -e "${GALBEN}[1/8] Verificare fișier configurare...${NC}"
|
||||
echo ""
|
||||
|
||||
if [ ! -e "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU} ✗ Fișier NU EXISTĂ: $CONFIG_FILE${NC}"
|
||||
echo -e "${GALBEN} → Soluție: Rulează ./install.sh sau creează manual${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${VERDE} ✓ Fișier există${NC}"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU} ✗ Calea nu este un fișier obișnuit${NC}"
|
||||
ls -ld "$CONFIG_FILE"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${VERDE} ✓ Este fișier obișnuit${NC}"
|
||||
fi
|
||||
|
||||
if [ ! -r "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU} ✗ Fișier NU POATE FI CITIT${NC}"
|
||||
echo -e "${GALBEN} → Permisiuni curente:${NC}"
|
||||
ls -la "$CONFIG_FILE"
|
||||
echo -e "${GALBEN} → Soluție: chmod 600 $CONFIG_FILE${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${VERDE} ✓ Poate fi citit${NC}"
|
||||
fi
|
||||
|
||||
if [ ! -s "$CONFIG_FILE" ]; then
|
||||
echo -e "${ROSU} ✗ Fișier este GOL (0 bytes)${NC}"
|
||||
echo -e "${GALBEN} → Soluție: Regenerează config${NC}"
|
||||
exit 1
|
||||
else
|
||||
local size=$(stat -f%z "$CONFIG_FILE" 2>/dev/null || stat -c%s "$CONFIG_FILE" 2>/dev/null)
|
||||
echo -e "${VERDE} ✓ Mărime: $size bytes${NC}"
|
||||
fi
|
||||
|
||||
# 2. Verificare permisiuni detaliate
|
||||
echo ""
|
||||
echo -e "${GALBEN}[2/8] Verificare permisiuni detaliate...${NC}"
|
||||
echo ""
|
||||
|
||||
ls -la "$CONFIG_FILE"
|
||||
|
||||
local owner=$(stat -f%Su "$CONFIG_FILE" 2>/dev/null || stat -c%U "$CONFIG_FILE" 2>/dev/null)
|
||||
local current_user=$(whoami)
|
||||
|
||||
echo ""
|
||||
if [ "$owner" != "$current_user" ]; then
|
||||
echo -e "${GALBEN} ⚠ Proprietar fișier: $owner (tu ești: $current_user)${NC}"
|
||||
echo -e "${GALBEN} → Acest lucru poate cauza probleme de permisiuni${NC}"
|
||||
else
|
||||
echo -e "${VERDE} ✓ Proprietar fișier: $owner (corect)${NC}"
|
||||
fi
|
||||
|
||||
# 3. Verificare conținut fișier
|
||||
echo ""
|
||||
echo -e "${GALBEN}[3/8] Verificare conținut fișier...${NC}"
|
||||
echo ""
|
||||
|
||||
local lines=$(wc -l < "$CONFIG_FILE")
|
||||
echo -e " Linii total: $lines"
|
||||
|
||||
local general_blocks=$(grep -c "^General {" "$CONFIG_FILE" 2>/dev/null || echo 0)
|
||||
echo -e " Blocuri General: $general_blocks"
|
||||
|
||||
if [ "$general_blocks" -eq 0 ]; then
|
||||
echo -e "${ROSU} ✗ LIPSEȘTE blocul General { }!${NC}"
|
||||
echo -e "${GALBEN} → Config invalid, trebuie să aibă cel puțin un bloc General${NC}"
|
||||
fi
|
||||
|
||||
local port_blocks=$(grep -c "^Port {" "$CONFIG_FILE" 2>/dev/null || echo 0)
|
||||
echo -e " Blocuri Port: $port_blocks"
|
||||
|
||||
if [ "$port_blocks" -eq 0 ]; then
|
||||
echo -e "${ROSU} ✗ LIPSEȘTE blocul Port { }!${NC}"
|
||||
echo -e "${GALBEN} → Serverul nu va avea porturi de ascultare${NC}"
|
||||
fi
|
||||
|
||||
# 4. Verificare sintaxă acolade
|
||||
echo ""
|
||||
echo -e "${GALBEN}[4/8] Verificare sintaxă acolade...${NC}"
|
||||
echo ""
|
||||
|
||||
local open_braces=$(grep -o "{" "$CONFIG_FILE" | wc -l)
|
||||
local close_braces=$(grep -o "}" "$CONFIG_FILE" | wc -l)
|
||||
|
||||
echo -e " Acolade deschise { : $open_braces"
|
||||
echo -e " Acolade închise } : $close_braces"
|
||||
|
||||
if [ "$open_braces" -ne "$close_braces" ]; then
|
||||
echo -e "${ROSU} ✗ ACOLADE NEPOTRIVITE!${NC}"
|
||||
echo -e "${GALBEN} → Diferență: $(($open_braces - $close_braces))${NC}"
|
||||
else
|
||||
echo -e "${VERDE} ✓ Acolade potrivite${NC}"
|
||||
fi
|
||||
|
||||
# 5. Verificare executabil ircd
|
||||
echo ""
|
||||
echo -e "${GALBEN}[5/8] Verificare executabil ircd...${NC}"
|
||||
echo ""
|
||||
|
||||
if [ ! -f "$IRCD_BIN" ]; then
|
||||
echo -e "${ROSU} ✗ Executabil NU EXISTĂ: $IRCD_BIN${NC}"
|
||||
echo -e "${GALBEN} → Soluție: Rulează ./install.sh pentru compilare${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${VERDE} ✓ Executabil există${NC}"
|
||||
fi
|
||||
|
||||
if [ ! -x "$IRCD_BIN" ]; then
|
||||
echo -e "${ROSU} ✗ Executabil NU ARE permisiuni de execuție${NC}"
|
||||
echo -e "${GALBEN} → Soluție: chmod +x $IRCD_BIN${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${VERDE} ✓ Permisiuni execuție OK${NC}"
|
||||
fi
|
||||
|
||||
# 6. Test sintaxă configurare cu ircd
|
||||
echo ""
|
||||
echo -e "${GALBEN}[6/8] Test sintaxă cu ircd -c...${NC}"
|
||||
echo ""
|
||||
|
||||
if "$IRCD_BIN" -c -f "$CONFIG_FILE" > /tmp/ircd_config_test.log 2>&1; then
|
||||
echo -e "${VERDE} ✓ Config VALID - Sintaxă OK${NC}"
|
||||
cat /tmp/ircd_config_test.log
|
||||
else
|
||||
echo -e "${ROSU} ✗ Config INVALID - Erori detectate:${NC}"
|
||||
echo -e "${GALBEN}────────────────────────────────────────${NC}"
|
||||
cat /tmp/ircd_config_test.log
|
||||
echo -e "${GALBEN}────────────────────────────────────────${NC}"
|
||||
rm -f /tmp/ircd_config_test.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f /tmp/ircd_config_test.log
|
||||
|
||||
# 7. Verificare directoare necesare
|
||||
echo ""
|
||||
echo -e "${GALBEN}[7/8] Verificare directoare necesare...${NC}"
|
||||
echo ""
|
||||
|
||||
for dir in "$PREFIX/bin" "$PREFIX/etc" "$PREFIX/log"; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo -e "${ROSU} ✗ Director lipsă: $dir${NC}"
|
||||
echo -e "${GALBEN} → Creare: mkdir -p $dir${NC}"
|
||||
mkdir -p "$dir"
|
||||
else
|
||||
echo -e "${VERDE} ✓ $dir${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
# 8. Verificare proces pornit
|
||||
echo ""
|
||||
echo -e "${GALBEN}[8/8] Verificare proces IRCd...${NC}"
|
||||
echo ""
|
||||
|
||||
if pgrep -f "$IRCD_BIN" > /dev/null; then
|
||||
local pid=$(pgrep -f "$IRCD_BIN")
|
||||
echo -e "${VERDE} ✓ Proces PORNIT${NC}"
|
||||
echo -e " PID: $pid"
|
||||
ps aux | grep "$pid" | grep -v grep
|
||||
else
|
||||
echo -e "${GALBEN} ℹ Niciun proces activ${NC}"
|
||||
echo -e " (Aceasta este normal dacă nu ai pornit serverul)${NC}"
|
||||
fi
|
||||
|
||||
# Sumar final
|
||||
echo ""
|
||||
echo -e "${ALBASTRU}╔════════════════════════════════════════╗${NC}"
|
||||
echo -e "${ALBASTRU}║ SUMAR DIAGNOSTICARE ║${NC}"
|
||||
echo -e "${ALBASTRU}╚════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
|
||||
if [ "$general_blocks" -gt 0 ] && [ "$port_blocks" -gt 0 ] && [ "$open_braces" -eq "$close_braces" ]; then
|
||||
echo -e "${VERDE}✓ Toate verificările au trecut cu succes!${NC}"
|
||||
echo -e "${VERDE}✓ Configurarea pare să fie validă.${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}Poți porni serverul cu:${NC}"
|
||||
echo -e " $IRCD_BIN -f $CONFIG_FILE"
|
||||
echo ""
|
||||
echo -e "${GALBEN}SAU folosind meniul admin:${NC}"
|
||||
echo -e " ./admin.sh → opțiunea 1 (Pornire server)"
|
||||
echo ""
|
||||
else
|
||||
echo -e "${ROSU}✗ Au fost detectate probleme!${NC}"
|
||||
echo ""
|
||||
echo -e "${GALBEN}Pași recomandați:${NC}"
|
||||
echo -e " 1. Verifică manual config: nano $CONFIG_FILE"
|
||||
echo -e " 2. Compară cu exemplu: cat doc/example.conf"
|
||||
echo -e " 3. SAU regenerează config: ./admin.sh → opțiunea 5"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo -e "${GALBEN}Pentru mai multe detalii:${NC}"
|
||||
echo -e " - Verifică log: tail -f $LOG_FILE"
|
||||
echo -e " - Rulează admin: ./admin.sh"
|
||||
echo ""
|
||||
|
||||
Loading…
Reference in New Issue