init repo
This commit is contained in:
21
run-export.sh
Executable file
21
run-export.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user