translate
This commit is contained in:
parent
c33614b635
commit
548702b50b
@ -1,49 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Terminal temizleme fonksiyonu
|
||||
# Terminal clearing function
|
||||
clear_screen() {
|
||||
clear
|
||||
echo "Log Monitoring Active - Press Ctrl+C to exit"
|
||||
echo "___________________________________________________________"
|
||||
}
|
||||
|
||||
# Global değişkenler
|
||||
# Global variables
|
||||
last_increment=""
|
||||
last_change_time=$(date +%s)
|
||||
last_decrease_time=$(date +%s)
|
||||
CHECK_INTERVAL=5 # Kontrol aralığı (saniye)
|
||||
RESTART_THRESHOLD=$((5 * 60)) # 5 dakika (saniye cinsinden)
|
||||
RESTART_WAIT_TIME=$((1* 60)) # Yeniden başlatma sonrası 5 dakika bekleme
|
||||
CHECK_INTERVAL=5 # Check interval (seconds)
|
||||
RESTART_THRESHOLD=$((5 * 60)) # 5 minutes (in seconds)
|
||||
RESTART_WAIT_TIME=$((1* 60)) # Wait 1 minute after restart
|
||||
last_restart_time=0
|
||||
increment_updated=""
|
||||
|
||||
# ANSI renk kodları
|
||||
# ANSI color codes
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
CYAN='\033[0;36m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Servis yeniden başlatma fonksiyonu
|
||||
# Service restart function
|
||||
restart_service() {
|
||||
local reason=$1
|
||||
echo -e "${RED}YENİDEN BAŞLATMA SEBEBİ: $reason${NC}"
|
||||
echo "Servis yeniden başlatılıyor..."
|
||||
echo -e "${RED}REASON FOR RESTART: $reason${NC}"
|
||||
echo "Restarting service..."
|
||||
sudo systemctl restart ceremonyclient.service
|
||||
last_restart_time=$(date +%s)
|
||||
last_change_time=$last_restart_time
|
||||
last_decrease_time=$last_restart_time
|
||||
|
||||
echo -e "${YELLOW}Servis yeniden başlatıldı. Logların sağlıklı oluşması için 5 dakika bekleniyor...${NC}"
|
||||
echo -e "${YELLOW}Service restarted. Waiting 5 minutes for logs to stabilize...${NC}"
|
||||
for i in {300..1}; do
|
||||
echo -ne "Kalan süre: $i saniye\r"
|
||||
echo -ne "Remaining time: $i seconds\r"
|
||||
sleep 1
|
||||
done
|
||||
echo -e "\nBekleme süresi tamamlandı. Log analizi başlıyor..."
|
||||
echo -e "\nWait time complete. Starting log analysis..."
|
||||
sleep 2
|
||||
}
|
||||
|
||||
# Sürekli çalışacak while döngüsü
|
||||
# Continuously running while loop
|
||||
while true; do
|
||||
clear_screen
|
||||
current_time=$(date +%s)
|
||||
@ -52,8 +52,8 @@ while true; do
|
||||
time_since_restart=$((current_time - last_restart_time))
|
||||
if [ $last_restart_time -ne 0 ] && [ $time_since_restart -lt $RESTART_WAIT_TIME ]; then
|
||||
remaining_wait=$((RESTART_WAIT_TIME - time_since_restart))
|
||||
echo -e "${YELLOW}Son yeniden başlatmadan bu yana $time_since_restart saniye geçti."
|
||||
echo -e "Yeni bir yeniden başlatma için $remaining_wait saniye bekleniyor...${NC}"
|
||||
echo -e "${YELLOW}It's been $time_since_restart seconds since the last restart."
|
||||
echo -e "Waiting $remaining_wait seconds before a new restart can be triggered...${NC}"
|
||||
else
|
||||
last_decrease=$(sudo journalctl -u ceremonyclient.service -o short-iso -n 2000 | grep 'publishing' | tail -n 20 | \
|
||||
awk -v current_time="$current_time" '
|
||||
@ -91,7 +91,7 @@ while true; do
|
||||
|
||||
if [ $time_since_restart -ge $RESTART_WAIT_TIME ] || [ $last_restart_time -eq 0 ]; then
|
||||
if [ ! -z "$last_decrease" ] && [ "$last_decrease" -gt "$RESTART_THRESHOLD" ]; then
|
||||
restart_service "Son düşüş $last_decrease saniye önce gerçekleşti (5 dakikadan fazla)"
|
||||
restart_service "Last decrease was $last_decrease seconds ago (more than 5 minutes)"
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -99,19 +99,19 @@ while true; do
|
||||
if [ "$current_increment" != "$last_increment" ]; then
|
||||
last_increment=$current_increment
|
||||
last_change_time=$current_time
|
||||
increment_updated="${YELLOW}Increment değeri güncellendi: $current_increment${NC}"
|
||||
increment_updated="${YELLOW}Increment value updated: $current_increment${NC}"
|
||||
else
|
||||
time_since_last_change=$((current_time - last_change_time))
|
||||
|
||||
if [ $time_since_last_change -ge $RESTART_THRESHOLD ]; then
|
||||
restart_service "Increment değeri $time_since_last_change saniyedir değişmedi"
|
||||
restart_service "Increment value has not changed for $time_since_last_change seconds"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Log analizi çıktısı
|
||||
# Log analysis output
|
||||
sudo journalctl -u ceremonyclient.service -o short-iso -n 2000 | grep 'publishing' | tail -n 20 | \
|
||||
awk -v current_time="$current_time" '
|
||||
BEGIN {
|
||||
@ -148,7 +148,7 @@ while true; do
|
||||
}'
|
||||
|
||||
|
||||
# Devam eden istatistikler
|
||||
# Ongoing statistics
|
||||
sudo journalctl -u ceremonyclient.service -o short-iso -n 2000 | grep 'publishing' | tail -n 20 | \
|
||||
awk -v current_time="$current_time" '
|
||||
BEGIN {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user