obsidian-support-scripts/termux_trigger.sh
baalajimaestro e378e715f1
Add a script to trigger sync on mobile
Use it in combination with tasker triggers

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
2022-10-09 19:00:48 +05:30

17 lines
607 B
Bash

#! /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