2025-01-15 10:42:01 +00:00
|
|
|
# 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
|
2025-01-15 10:51:25 +00:00
|
|
|
|
2025-01-15 10:42:01 +00:00
|
|
|
while true
|
|
|
|
do
|
|
|
|
clear
|
2025-01-15 10:44:23 +00:00
|
|
|
# Update if file changed 5 seconds ago
|
|
|
|
last_changed=$(find . -newermt "5 seconds ago" | grep -v .git)
|
2025-01-15 10:42:01 +00:00
|
|
|
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"
|
2025-01-15 10:44:23 +00:00
|
|
|
sleep 5
|
2025-01-15 10:42:01 +00:00
|
|
|
else
|
|
|
|
echo -e "Status: \e[32msynced\e[0m"
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|