public_notes/utils/sync-notes.sh
2024-02-22 21:20:52 +09:00

34 lines
585 B
Bash
Executable file

#!/usr/bin/env bash
. ./sync-config
echo "syncing notes..."
## sync dropbox -> mirror
# memos
$RCLONE sync ${dropbox_src_memos} ${mirror_dest_memos} -v
# assets
$RCLONE sync ${dropbox_src_assets} ${mirror_dest_assets} -v
## sync mirror -> git repo dest
# memos
$RSYNC ${mirror_dest_memos} ${git_repo_dest}
$RSYNC ${mirror_dest_assets} ${git_repo_dest}/assets/
pushd ${git_repo_root}
## git
if [[ `git status --porcelain` ]]; then
# Changes
echo 'changes!'
git add .
git commit -m "sync notes(auto)"
git pull
git push
else
# No changes
:
fi
popd