File size: 449 Bytes
afa4de7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

URL_FILE="/workspaces/arf-api/current_url.txt"
LOG_FILE="/workspaces/arf-api/monitor.log"

if [ ! -f "$URL_FILE" ]; then
    echo "$(date): No URL file found. Exiting." >> "$LOG_FILE"
    exit 1
fi

CURRENT_URL=$(cat "$URL_FILE")

if ! curl -s -f "$CURRENT_URL/health" > /dev/null; then
    echo "$(date): Tunnel down. Restarting..." >> "$LOG_FILE"
    /workspaces/arf-api/start.sh
else
    echo "$(date): Tunnel OK." >> "$LOG_FILE"
fi