반응형
Window Service
-
python 으로 window service 관리python/기타 2021. 10. 6. 17:08
최근 윈도우 웹서버에서 apache 서비스가 자꾸 죽는 경우가 생겨서 python 으로 window 서비스를 정지, 시작, 재시작 프로그램을 작성하였습니다. 필요 모듈로는 pywin32, requests pip install pywin32 pip install requests 을 이용해서 설치합니다. import requests import win32serviceutil r = requests.get('http://www.aaa.com', timeout=10) # 응답이 없거나 200 이 아니면 재시작 if r.status_code != 200 : try: win32serviceutil.QueryServiceStatus(serviceName) except Exception as e: print("그런 서..