From 3650683125f63d46339580317d6c491bab30124b Mon Sep 17 00:00:00 2001 From: oddbyte Date: Mon, 19 Jan 2026 00:15:43 -0500 Subject: [PATCH] add a script to automatically pull changes from git --- autoupdate.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 autoupdate.sh diff --git a/autoupdate.sh b/autoupdate.sh new file mode 100644 index 0000000..7f820e5 --- /dev/null +++ b/autoupdate.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +LOCKFILE="/tmp/git_pull_lock" + +if [ -f "$LOCKFILE" ]; then + echo "Script is already running. Exiting." + exit 1 +fi + +touch "$LOCKFILE" + +trap 'rm -f "$LOCKFILE"' EXIT + +while true; do + output=$(git pull 2>&1) + + # Check if git pull actually fetched changes + if echo "$output" | grep -q "Already up[[:space:]]*to[[:space:]]*date\|up-to-date"; then + echo "No changes. $(date)" + else + echo "Changes pulled. $(date)" + echo "$output" + ./start.sh + fi + + sleep 60 +done