Files
beast-trader/scripts/push_brief_to_gitea.sh

25 lines
783 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# push_brief_to_gitea.sh
# 日报生成后推送至 Gitea
# 由 daily_brief.py 在生成日报后调用,或 cron 单独执行
# 用法bash scripts/push_brief_to_gitea.sh [日期 YYYY-MM-DD]
BRIEF_DATE="${1:-$(date +%Y-%m-%d)}"
BRIEF_FILE="/home/ubuntu/freqtrade/user_data/daily_briefs/${BRIEF_DATE}.txt"
REPO_DIR="/home/ubuntu/beast-trader"
DEST_DIR="${REPO_DIR}/daily_briefs/$(echo ${BRIEF_DATE} | cut -d- -f1)"
mkdir -p "${DEST_DIR}"
if [ -f "${BRIEF_FILE}" ]; then
cp "${BRIEF_FILE}" "${DEST_DIR}/${BRIEF_DATE}.txt"
cd "${REPO_DIR}"
git add "daily_briefs/"
git commit -m "brief: auto push ${BRIEF_DATE}" --allow-empty
git push
echo "Brief ${BRIEF_DATE} pushed to Gitea"
else
echo "Brief file not found: ${BRIEF_FILE}"
exit 1
fi