작업 폴더 변경

This commit is contained in:
2025-06-30 14:32:52 +09:00
parent 97d804e801
commit ed56635eb9
6 changed files with 17 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
config.py
data/__pycache__/
app/__pycache__/

View File

@ -163,11 +163,12 @@ def main():
MAIN['content'] = weather_content
today = datetime.today().strftime('%Y%m%d')
script_dir = os.path.dirname(os.path.abspath(__file__))
capture_script = os.path.join(script_dir, 'weather_capture.py')
data_dir = '/data' # 파일 저장 및 업로드 디렉토리
capture_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'weather_capture.py')
weather_filename = f'weather_capture_{today}.png'
weather_file = os.path.join(script_dir, weather_filename)
thumb_file = os.path.join(script_dir, 'thumb.jpg')
weather_file = os.path.join(data_dir, weather_filename)
thumb_file = os.path.join(data_dir, 'thumb.jpg')
if not capture_image(capture_script, weather_file):
return
@ -190,14 +191,14 @@ def main():
)
try:
# weather_file만 삭제, thumb.jpg는 삭제하지 않음
if os.path.isfile(weather_file):
os.remove(weather_file)
print(f"[정리 완료] 캡처 이미지 삭제됨: {weather_file}")
## weather_file만 삭제, thumb.jpg는 삭제하지 않음
#if os.path.isfile(weather_file):
# os.remove(weather_file)
# print(f"[정리 완료] 캡처 이미지 삭제됨: {weather_file}")
pass
except Exception as e:
print(f"[삭제 오류] {type(e).__name__}: {e}")
if __name__ == "__main__":
main()

View File

@ -1,3 +1,3 @@
#!/bin/bash
echo "run.sh 시작: $(date '+%Y-%m-%d %H:%M:%S')"
python3 /data/gnu_autoupload.py >> /proc/1/fd/1 2>&1
python3 /app/gnu_autoupload.py >> /proc/1/fd/1 2>&1

View File

@ -65,7 +65,11 @@ try:
))
# 저장 경로 설정
save_path = os.path.join(script_dir, f'weather_capture_{TODAY}.png')
# 기존
# save_path = os.path.join(script_dir, f'weather_capture_{TODAY}.png')
# 수정
save_path = os.path.join('/data', f'weather_capture_{TODAY}.png')
# 요소 스크린샷 저장
target_element.screenshot(save_path)