Last active
February 23, 2023 09:48
-
-
Save sarkrui/cb3e8a879b200738a75f8190509aee14 to your computer and use it in GitHub Desktop.
备份微信聊天记录
This file contains 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 | |
#I usually put bash scripts under this folder | |
mkdir ~/.scripts | |
#wget backup script | |
wget --no-check-certificate https://gist.github.com/sarkrui/cb3e8a879b200738a75f8190509aee14/raw/WeChat_backup.sh | |
#making it execuatable | |
chmod +x WeChat_backup.sh | |
#write out current crontab | |
crontab -l > mycron | |
#echo new cron into cron file | |
# 0 2 * * * crontab = Scheduled at evryday at 01:30 | |
# 2>&1 indicates that the standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1). | |
echo "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n*/~/.scripts && ./WeChat_backup.sh > ~/.scripts/log/WeChat_backup.log 2>&1" >> mycron | |
#install new cron file | |
crontab mycron | |
rm mycron | |
echo "Crontab schedule created!" | |
This file contains 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 | |
#change working directory to Desktop | |
cd ~/Desktop | |
# remove any previously existing compressed files | |
rm -f WeChat_history* | |
# generate the new updated | |
tar -vczf ~/Desktop/WeChat_history$(date +%F_%R).tgz ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat | |
# shall config rclone at the first place | |
# push to Google Drive name Team, (Google Team Drive has 5T storage) | |
# under the root (/) directory, | |
# and shows progress by -P | |
rclone sync ~/Desktop/WeChat_history* Team:/ -P | |
echo "Done!" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tar 原生不支持加密,可以自行安装 7-zip
-pYourPasswd
加密文件夹命令解释
参考: