Created
April 20, 2025 13:30
-
-
Save zwzheng45/55edc1063d1c5f40c5569888ecbeb6bd to your computer and use it in GitHub Desktop.
定时同步rime词典
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /Users/zzw/GitHub/rime-fast-xhup || { echo "目录不存在"; exit 1; } | |
echo "从远程仓库更新... " | |
git pull | |
echo "覆盖旧词典... " | |
# cp cn_dicts/flypy_sogou.dict.yaml /Users/zzw/Library/Rime/cn_dicts/flypy_sogou.dict.yaml || { echo "覆盖失败"; exit 1; } | |
TARGET_DIR="/Users/zzw/Library/Rime" | |
# 同步中文词典文件 | |
rsync -av cn_dicts/ "$TARGET_DIR/cn_dicts/" || { echo "覆盖失败"; exit 1; } | |
# 同步英文词典文件 | |
rsync -av en_dicts/ "$TARGET_DIR/en_dicts/" || { echo "覆盖失败"; exit 1; } | |
osascript -e 'display notification "记得在空闲时重新部署" with title "Rime 词典已更新"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.zzw.auto_update_rime</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/bin/bash</string> | |
<string>/Users/zzw/Library/LaunchAgents/auto_update_rime.sh</string> | |
</array> | |
<key>StartCalendarInterval</key> | |
<dict> | |
<key>Hour</key> | |
<integer>9</integer> | |
<key>Minute</key> | |
<integer>0</integer> | |
</dict> | |
<key>StandardOutPath</key> | |
<string>/tmp/auto_update_rime.out</string> | |
<key>StandardErrorPath</key> | |
<string>/tmp/auto_update_rime.err</string> | |
</dict> | |
</plist> |
为什么当初不用crontab呢,感觉比launchctl更容易也更通用一些 (小声bb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
launchctl load com.zzw.auto_update_rime.plist