forked from SocialTensor/SocialTensorSubnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_update.sh
32 lines (25 loc) · 896 Bytes
/
auto_update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
while true; do
# Log the start of the script execution
echo "$(date): Script started"
# Save the current HEAD hash
current_head=$(git rev-parse HEAD)
# Pull the latest changes from the repository
git stash
git pull -f
git reset --hard origin/main
# Get the new HEAD hash
new_head=$(git rev-parse HEAD)
# Check if the new HEAD is different from the current HEAD
if [ "$current_head" != "$new_head" ]; then
# The HEAD has changed, meaning there's a new version
echo "$(date): New version detected, installing requirements and restarting the validator."
pip install -e .
pm2 restart validator_nicheimage
else
# No new version, no action needed
echo "$(date): No new version detected, no restart needed."
fi
# Sleep until the beginning of the next hour
sleep 3600
done