split servises
This commit is contained in:
18
setup.sh
18
setup.sh
@@ -178,7 +178,7 @@ print('✓ Все основные пакеты успешно импортир
|
|||||||
create_systemd_services() {
|
create_systemd_services() {
|
||||||
local team="$1"
|
local team="$1"
|
||||||
|
|
||||||
log_info "Создание отдельных systemd сервисов..."
|
log_info "Создание отдельных systemd сервисов для команды: $team"
|
||||||
|
|
||||||
# Останавливаем и отключаем старые сервисы если они есть
|
# Останавливаем и отключаем старые сервисы если они есть
|
||||||
for service in rfb-data.service rfb-visual.service rfb-stat.service; do
|
for service in rfb-data.service rfb-visual.service rfb-stat.service; do
|
||||||
@@ -205,7 +205,7 @@ Type=simple
|
|||||||
User=root
|
User=root
|
||||||
WorkingDirectory=/root/RFB
|
WorkingDirectory=/root/RFB
|
||||||
Environment=PATH=/root/RFB/.venv/bin
|
Environment=PATH=/root/RFB/.venv/bin
|
||||||
ExecStart=/root/RFB/.venv/bin/python3 get_data.py --team $team
|
ExecStart=/root/RFB/.venv/bin/python3 /root/RFB/get_data.py --team $team
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
@@ -221,15 +221,14 @@ EOF
|
|||||||
cat > $visual_service_file << EOF
|
cat > $visual_service_file << EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=RFB Visual Service
|
Description=RFB Visual Service
|
||||||
After=network.target
|
After=network.target rfb-data.service
|
||||||
Wants=rfb-data.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
WorkingDirectory=/root/RFB
|
WorkingDirectory=/root/RFB
|
||||||
Environment=PATH=/root/RFB/.venv/bin
|
Environment=PATH=/root/RFB/.venv/bin
|
||||||
ExecStart=/root/RFB/.venv/bin/streamlit run visual.py --server.port 8501 --server.address 0.0.0.0
|
ExecStart=/root/RFB/.venv/bin/streamlit run /root/RFB/visual.py --server.port 8501 --server.address 0.0.0.0
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
@@ -321,6 +320,7 @@ detect_team() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Возвращаем только чистую строку с названием команды
|
||||||
echo "$final_team"
|
echo "$final_team"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,8 +422,12 @@ main() {
|
|||||||
# Настройка виртуального окружения
|
# Настройка виртуального окружения
|
||||||
setup_venv
|
setup_venv
|
||||||
|
|
||||||
# Определение команды
|
# Определение команды - ВАЖНО: используем временный файл для чистого вывода
|
||||||
final_team=$(detect_team "$team")
|
local temp_team_file=$(mktemp)
|
||||||
|
final_team=$(detect_team "$team" | tail -1)
|
||||||
|
rm -f "$temp_team_file"
|
||||||
|
|
||||||
|
log_info "Финальная команда: $final_team"
|
||||||
|
|
||||||
# Проверка файлов
|
# Проверка файлов
|
||||||
check_required_files
|
check_required_files
|
||||||
|
|||||||
Reference in New Issue
Block a user