From 3af65c3be8c09ca0d6923c12612668d51e709c32 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 Apr 2026 23:19:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BC=D0=B8=D1=82:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82?= =?UTF-8?q?=D1=83=D1=80=D0=B0=20=D0=B8=20=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 ++++++++ auto-update/sync_scripts.sh | 24 ++++++++++++++++++++++++ bash/system_info.sh | 15 +++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 auto-update/sync_scripts.sh create mode 100644 bash/system_info.sh diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/auto-update/sync_scripts.sh b/auto-update/sync_scripts.sh new file mode 100644 index 0000000..87528bd --- /dev/null +++ b/auto-update/sync_scripts.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Замени Tvoi_Login на свой логин в Gitea +REPO_URL="https://gitlab.alex2py.ru/Tvoi_Login/server-tools.git" +DEST_DIR="/opt/server-tools" + +echo "Запуск синхронизации скриптов..." + +if ! command -v git &> /dev/null; then + echo "Ошибка: Git не установлен." + exit 1 +fi + +if [ ! -d "$DEST_DIR" ]; then + echo "Клонирую репозиторий..." + git clone "$REPO_URL" "$DEST_DIR" +else + echo "Обновляю репозиторий..." + cd "$DEST_DIR" || exit + git reset --hard HEAD + git pull origin main +fi + +find "$DEST_DIR/bash" -type f -name "*.sh" -exec chmod +x {} \; +echo "Готово!" \ No newline at end of file diff --git a/bash/system_info.sh b/bash/system_info.sh new file mode 100644 index 0000000..5ffd0f2 --- /dev/null +++ b/bash/system_info.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e +GREEN='\033[0;32m' +NC='\033[0m' + +echo -e "${GREEN}=== Сбор информации о сервере ===${NC}" +echo -e "\n${GREEN}[1] Операционная система:${NC}" +cat /etc/os-release | grep "PRETTY_NAME" | cut -d '"' -f 2 + +echo -e "\n${GREEN}[2] Свободное место на диске:${NC}" +df -h / | awk 'NR==2 {print "Всего: " $2 ", Использовано: " $3 ", Свободно: " $4}' + +echo -e "\n${GREEN}[3] Оперативная память:${NC}" +free -m | awk 'NR==2 {print "Всего: " $2 "MB, Использовано: " $3 "MB, Свободно: " $4 "MB"}' +echo -e "\n${GREEN}=== Готово! ===${NC}" \ No newline at end of file