Files
20260324-42433647/run-export.sh
2026-04-25 21:50:03 +08:00

22 lines
709 B
Bash
Executable File
Raw 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
# 店小秘自动导出 - cron 启动脚本
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
export HOME="/Users/kangwan"
cd /Users/kangwan/Projects/business/20260324-店小秘自动导出
# 加载 nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# 运行导出
node export.mjs >> export.log 2>&1
EXIT_CODE=$?
# 如果失败Cookie 过期),弹系统通知
if [ $EXIT_CODE -ne 0 ]; then
osascript -e 'display notification "Cookie 已过期,请运行 node login.mjs 重新登录" with title "店小秘自动导出" sound name "Basso"'
echo "[$(date '+%Y/%m/%d %H:%M:%S')] ✗ 导出失败Cookie 可能过期" >> export.log
fi