add a script to automatically pull changes from git

This commit is contained in:
2026-01-19 00:15:43 -05:00
parent 47c8ff17c7
commit 3650683125

27
autoupdate.sh Normal file
View File

@@ -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