From 5ba93c437725a0e4d4659f7b7eaaf1d78fb407c3 Mon Sep 17 00:00:00 2001 From: jinsu Date: Thu, 11 Dec 2025 23:53:36 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A7=A4=EC=9D=BC=20=EC=98=A4=EC=A0=84=209:30?= =?UTF-8?q?=20=EC=95=8C=EB=A6=BC=20cron=20job=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/cronjob.yaml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 deploy/cronjob.yaml diff --git a/deploy/cronjob.yaml b/deploy/cronjob.yaml new file mode 100644 index 0000000..1bcf55b --- /dev/null +++ b/deploy/cronjob.yaml @@ -0,0 +1,37 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: weather-notification +spec: + schedule: "30 9 * * *" + timeZone: "Asia/Seoul" + jobTemplate: + spec: + template: + spec: + containers: + - name: weather-notifier + image: alpine:latest + command: + - /bin/sh + - -c + - | + apk add --no-cache curl jq + + # 날씨 데이터 가져오기 + WEATHER_DATA=$(curl -s seven-skies-app:8080/forecasts/daily | jq .items[0]) + + # JSON 형식 변환 (date: condition high/low 형식) + BODY=$(echo "$WEATHER_DATA" | jq -r ' + "\(.date): \(.condition) \(.high)/\(.low)" + ') + + # Apprise API로 전송 + curl -X POST "http://apprise:8000/notify" \ + -H "Content-Type: application/json" \ + -d "{ + \"urls\": \"pover://ukqirq63ptby2z9ctgh67ae1636m2o@abiiap2zy7hzr9rt4vqybvqj8b24yq?priority=high\", + \"body\": $(echo "$BODY" | jq -Rs .), + \"title\": \"오늘의 날씨\" + }" + restartPolicy: OnFailure