From b940ba485263d09077440f75b9515f05aaf801a9 Mon Sep 17 00:00:00 2001 From: justuser Date: Wed, 15 Jan 2025 13:42:01 +0300 Subject: [PATCH] sync --- syncV2.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 syncV2.sh diff --git a/syncV2.sh b/syncV2.sh new file mode 100755 index 0000000..0d3ddfa --- /dev/null +++ b/syncV2.sh @@ -0,0 +1,27 @@ +# Check for updates in remote repo +git pull +# Update at the start (we don't know if file changed) +git add * +git commit -m 'sync' +git push + +while true +do +clear +# Update if file changed 10 seconds ago +last_changed=$(find . -newermt "10 seconds ago" | grep -v .git) +if [ "$last_changed" != "" ]; then + echo -e "Status: \e[31mnot synced\e[0m" + read -p "Press any key to sync." + git add * + git commit -m 'sync' + git push + clear + echo -e "Status: \e[33msleep...\e[0m" + sleep 10 +else + echo -e "Status: \e[32msynced\e[0m" + sleep 1 +fi + +done