Created
September 3, 2022 12:30
-
-
Save fishyer/8724000af74ef64adf22a76d2c34742d 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/sh | |
# 首先push到github,提交MyObsidian完成以后,再开始构建MyLogseq站点 | |
git push origin main | |
# 同时输出到控制台和file | |
function echof(){ | |
echo -e $1 | tee -a $log_path | |
} | |
function echoOK(){ | |
echof "[[OK]] $1" | |
} | |
function echoFail(){ | |
echof "[[Fail]] $1" | |
} | |
log_path="/d/Dropbox/MyObsidian/debug-log.md" | |
program_path=${0##*/} | |
program_name=$(basename $program_path .sh) | |
program_date=`date '+%Y-%m-%d'` | |
program_time=`date '+%H-%M-%S'` | |
program_datef=`date '+%Y-%m-%d_%H-%M-%S'` | |
# 输出md格式的日志,方便在Obsidan中查看和拆分 | |
echof "### [[$program_date]]____[[$program_time]]____[[$program_name]]" | |
echof "program_path=$program_path" | |
echof "pwd=$(pwd)" | |
echof "这是由脚本自动生成的日志-`date +%F`" | |
# 复制Ob库中的logseq子库到自动备份文件夹中,然后上传备份库到github | |
cp -r /d/Dropbox/MyObsidian/MyLogseq /d/AutoBackup/PublicLogseq-$program_datef | |
echoOK "cp -r /d/Dropbox/MyObsidian/TestLogseq /d/AutoBackup/PublicLogseq-$program_datef" | |
pwd | |
cd /d/AutoBackup/PublicLogseq-$program_datef | |
pwd | |
# git config --global init.defaultBranch main | |
# echof `git config --global init.defaultBranch` | |
git init | |
git add . | |
git commit -m "AutoBackup PublicLogseq-$program_datef" | |
echof "AutoBackup PublicLogseq-$program_datef" | |
git remote add origin git@github.com:fishyer/MyLogseq.git | |
echof `git remote -v` | |
git push -f -u origin main | |
echoOK "git push -f -u origin main" | |
echof "https://github.com/fishyer/MyLogseq" | |
echof "---\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment