-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestart_network.sh
More file actions
40 lines (32 loc) · 1.09 KB
/
Copy pathrestart_network.sh
File metadata and controls
40 lines (32 loc) · 1.09 KB
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
33
34
35
36
37
38
39
40
#!/bin/bash
# Script to restart the network
# This script is called by network_monitor.py when network is unresponsive
echo "Starting network restart process..."
# Read GitHub link from file (first line)
if [ -f "/root/qubic/github_link.txt" ]; then
FIRST_LINE=$(head -n 1 /root/qubic/github_link.txt)
echo "First line from file: $FIRST_LINE"
# Parse the line: "YYYY-MM-DD HH:MM:SS|GITHUB_LINK"
if [[ "$FIRST_LINE" == *"|"* ]]; then
GITHUB_LINK=$(echo "$FIRST_LINE" | cut -d'|' -f2)
TIMESTAMP=$(echo "$FIRST_LINE" | cut -d'|' -f1)
echo "GitHub link read from $TIMESTAMP: $GITHUB_LINK"
else
# Fallback for old format (just the link)
GITHUB_LINK="$FIRST_LINE"
echo "GitHub link read (old format): $GITHUB_LINK"
fi
else
echo "Error: GitHub link file not found"
exit 1
fi
# Run cleanup
echo "Running cleanup..."
cd /root/qubic/qubic_docker
./cleanup.sh
# Wait a bit for cleanup to complete
sleep 10
# Run deploy
echo "Running deploy with GitHub link: $GITHUB_LINK"
./deploy.sh "$GITHUB_LINK"
echo "Network restart completed"