This project is a solution for automatically syncing WeChat Moments every Friday. On machine .155, the light stays on when the graphics card sleeps; it cannot hibernate or sleep and must be fully shut down. The user is away from Monday to Friday and returns home on Friday evening, so the sync frequency was changed to once a week. The solution has the .223 server send a WOL magic packet at 19:30 every Friday to wake .155. After the user returns home, they log in to Windows with a password; WeChat opens on startup, and then the user scans the QR code with their phone to log in. After login, the Windows scheduled task MomentsNightlySync is triggered to run auto_sync_shutdown.ps1: wait up to 25 minutes for WeChat login, execute nightly_sync.ps1 to decrypt the WeChat database, export Moments, fetch new images, and incrementally import them into Memos, then automatically shut down 10 minutes after completion. The blog /moments.html is synced from Memos every day at 10:05 by blog-memos.timer, so after the Friday evening import, the blog automatically updates at 10:05 on Saturday. Currently, .223's wake script and timer have been enabled, and .155's scheduled task, startup item, and desktop shortcut have been configured; WOL, RDP login, and WeChat autostart have been tested in practice, and .155 has been shut down after testing.
Features
- 每周五 19:30 由 .223 自动发送 WOL 魔术包唤醒 .155
- Windows 登录后微信自启,等待扫码登录后触发同步
- 同步流程覆盖解密微信库、导出朋友圈、抓新图、增量导入 Memos
- 同步完成后 10 分钟自动关机,桌面提供取消关机快捷方式
- 博客 /moments.html 每天 10:05 从 Memos 同步,次日自动更新
- 支持手动双击「朋友圈同步并关机」触发,也可调整唤醒时间
Stack: WOL · systemd timer · Python · PowerShell · Windows 计划任务 · Memos · RDP
1. Server-side wake configuration
On .223, confirm that wake_155.py can send WOL magic packets normally, targeting the .155 NIC Intel I225-V, MAC 1C-83-41-31-3E-5C. /etc/systemd/system/blog-wake155.timer is set to trigger every Friday at 19:30 and has been enabled. After changing the time, run systemctl daemon-reload && systemctl restart blog-wake155.timer.
2. Windows-side startup and scheduled tasks
On .155, retain C:\\Users\\Administrator\\moments-export\\auto_sync_shutdown.ps1 and sync_then_shutdown.cmd. The scheduled task MomentsNightlySync is set to a logon trigger, with a time limit of 2 hours, and remains enabled; the startup item retains Administrator Startup\\Weixin.lnk so that WeChat starts automatically at login.
3. Daily sync process
After .155 is awakened on Friday, the user logs in to Windows with a password (locally or via RDP through .223). After WeChat opens and displays the QR code login screen, use a phone to scan the code and log in. The scheduled task waits for WeChat login for up to 25 minutes, then runs nightly_sync.ps1 to decrypt the WeChat database, export Moments, fetch new images, and incrementally import into Memos. It automatically shuts down 10 minutes after completion; to cancel, double-click “Cancel Automatic Shutdown” on the desktop or run shutdown /a.
4. Manual trigger and verification
When an immediate sync is needed, double-click “Moments Sync and Shutdown” on the desktop. During verification, check the timer status on .223, the scheduled task history on .155, and whether new content appears in Memos; the blog /moments.html syncs daily at 10:05, and after the Friday night import it automatically updates at 10:05 on Saturday. For script internal parameters not detailed in the materials, adjust according to the actual script instructions.