74 lines
1.7 KiB
Batchfile
74 lines
1.7 KiB
Batchfile
@echo off
|
|
title TorrentOps Telegram Bot
|
|
|
|
cd /d %~dp0
|
|
|
|
REM ==========================================
|
|
REM TorrentOps Launcher
|
|
REM ==========================================
|
|
|
|
echo ==========================================
|
|
echo Starting TorrentOps...
|
|
echo ==========================================
|
|
echo.
|
|
|
|
REM ------------------------------------------
|
|
REM Ensure venv exists
|
|
REM ------------------------------------------
|
|
|
|
if not exist venv (
|
|
echo Virtual environment not found.
|
|
echo Please run setup.bat first.
|
|
echo.
|
|
pause
|
|
exit /b
|
|
)
|
|
|
|
REM ------------------------------------------
|
|
REM Activate virtual environment
|
|
REM ------------------------------------------
|
|
|
|
call venv\Scripts\activate
|
|
|
|
REM ------------------------------------------
|
|
REM Ensure logs directory exists
|
|
REM ------------------------------------------
|
|
|
|
if not exist logs (
|
|
mkdir logs
|
|
)
|
|
|
|
REM ------------------------------------------
|
|
REM Timestamp
|
|
REM ------------------------------------------
|
|
|
|
for /f %%i in ('powershell -NoProfile -Command "Get-Date -Format yyyyMMdd_HHmmss"') do set TIMESTAMP=%%i
|
|
|
|
set LOGFILE=logs\TorrentOps_%TIMESTAMP%.log
|
|
|
|
echo Logging to:
|
|
echo %LOGFILE%
|
|
echo.
|
|
|
|
REM ------------------------------------------
|
|
REM Restart loop
|
|
REM ------------------------------------------
|
|
|
|
:loop
|
|
|
|
echo ========================================== >> "%LOGFILE%"
|
|
echo TorrentOps Start: %DATE% %TIME% >> "%LOGFILE%"
|
|
echo ========================================== >> "%LOGFILE%"
|
|
|
|
python main.py >> "%LOGFILE%" 2>&1
|
|
|
|
echo.
|
|
echo ==========================================
|
|
echo TorrentOps exited or crashed.
|
|
echo Restarting in 5 seconds...
|
|
echo ==========================================
|
|
echo.
|
|
|
|
timeout /t 5 >nul
|
|
|
|
goto loop |