[2026-05-27] 포맷 후 복구 설치 스크립트 추가
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import subprocess, os
|
||||
|
||||
pid_file = r'C:\Users\whdwo\OneDrive\바탕 화면\stockbot_v3\logs\bot.pid'
|
||||
|
||||
if os.path.exists(pid_file):
|
||||
try:
|
||||
pid = int(open(pid_file).read().strip())
|
||||
subprocess.run(['taskkill', '/PID', str(pid), '/F'], capture_output=True)
|
||||
print(f'PID 파일 종료: {pid}')
|
||||
except Exception as e:
|
||||
print(f'PID 파일 종료 실패: {e}')
|
||||
os.remove(pid_file)
|
||||
|
||||
r = subprocess.run(
|
||||
['powershell', '-Command',
|
||||
'Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "*app/main.py*" -or $_.CommandLine -like "*app\\main.py*" } | Select-Object -ExpandProperty ProcessId'],
|
||||
capture_output=True, text=True
|
||||
)
|
||||
pids = [p.strip() for p in r.stdout.strip().splitlines() if p.strip().isdigit()]
|
||||
for pid in pids:
|
||||
subprocess.run(['taskkill', '/PID', pid, '/F'], capture_output=True)
|
||||
print(f'잔존 프로세스 종료: {pid}')
|
||||
|
||||
if not pids:
|
||||
print('실행 중인 봇 없음 — 새로 시작합니다')
|
||||
Reference in New Issue
Block a user