some changes

master
serr 2025-04-13 16:59:05 +03:00
parent dfdf3b0b35
commit 2d6f9a788f
1 changed files with 10 additions and 10 deletions

20
eye.sh
View File

@ -15,16 +15,16 @@ CLEANUP_DONE=0
# Вывод в синем цвете
blue() {
echo -e "\033[34m$1\033[0m"
echo -e "\033[34mEYE | $1\033[0m"
}
# Очистка при завершении работы скрипта
cleanup() {
[ $CLEANUP_DONE -eq 1 ] && exit 0
blue "EYE | cleanup..."
blue "cleanup..."
kill_proc $1
rm -f $BINARY_PATH
blue "EYE | see you later!"
blue "see you later!"
CLEANUP_DONE=1
exit 0
}
@ -34,7 +34,7 @@ kill_proc() {
local pid=$1
if [ -n "$pid" ] && kill -0 $pid 2>/dev/null; then
kill $pid
blue "EYE | process killed (PID: $pid)"
blue "process killed (PID: $pid)"
fi
}
@ -60,7 +60,7 @@ check_changes() {
changed=1
LAST_MODS["$target"]=$current_mod
LAST_COUNTS["$target"]=$current_count
[ -n "$1" ] && blue "EYE | changes detected in \033[94m$target\033[0m"
[ -n "$1" ] && blue "changes detected in \033[94m$target\033[0m"
fi
done
@ -83,23 +83,23 @@ main() {
LAST_MODS["$target"]=0
LAST_COUNTS["$target"]=$(find "$target" -type f 2>/dev/null | wc -l)
fi
blue "EYE | started watching \033[94m$target\033[0m"
blue "started watching \033[94m$target\033[0m"
done
# Основной цикл работы скрипта
while true; do
check_changes $pid
if [ $? -eq 1 ]; then
blue "EYE | rebuilding..."
blue "rebuilding..."
$BUILD_CMD
if [ $? -eq 0 ]; then
blue "EYE | build successful. restarting..."
blue "build successful. restarting..."
kill_proc $pid
$BINARY_PATH &
pid=$!
blue "EYE | started new process (PID: $pid)"
blue "started new process (PID: $pid)"
else
blue "EYE | build failed"
blue "build failed"
fi
fi