From e378e715f1ffe116d90aee2b39490afaf130ddb8 Mon Sep 17 00:00:00 2001 From: baalajimaestro Date: Sun, 9 Oct 2022 19:00:48 +0530 Subject: [PATCH] Add a script to trigger sync on mobile Use it in combination with tasker triggers Signed-off-by: baalajimaestro --- termux_trigger.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 termux_trigger.sh diff --git a/termux_trigger.sh b/termux_trigger.sh new file mode 100644 index 0000000..c62fa02 --- /dev/null +++ b/termux_trigger.sh @@ -0,0 +1,17 @@ +#! /bin/bash + +OBSIDIAN_DATA_DIR="/storage/emulated/0/Documents/obsidian" + +for i in ${OBSIDIAN_REPO[@]}; do + if [[ -d "${OBSIDIAN_DATA_DIR}/${i}" ]]; then + cd "${OBSIDIAN_DATA_DIR}/${i}" + git add . + git commit -m "Vault Backup from Mobile as of $(date +%s)" + git fetch origin master + git merge master --no-edit + git push origin master + else + git clone "https://baalajimaestro:${REPO_PASSWORD}@git.baalajimaestro.me/baalajimaestro/${i}" "${OBSIDIAN_DATA_DIR}/${i}" + git config --global --add safe.directory "${OBSIDIAN_DATA_DIR}/${i}" + fi +done