19 lines
699 B
Bash
19 lines
699 B
Bash
#!/bin/bash
|
|
# AstroCom Dynamic IP Update Script
|
|
# Gets current public IP from https://myip.wtf/text and posts it to the AstroCom API
|
|
# Requires: curl
|
|
|
|
# Configuration
|
|
API_KEY="Your ASTROCOM API Key" # Replace with your AstroCom API Key!
|
|
|
|
|
|
|
|
# Get current IP
|
|
CURRENT_IP=$(curl -s https://myip.wtf/text)
|
|
if [[ -z "$CURRENT_IP" ]]; then
|
|
echo "Failed to retrieve current IP address."
|
|
exit 1
|
|
fi
|
|
echo "Current IP: $CURRENT_IP"
|
|
# Update IP via AstroCom API PATCH https://astrocom.tel/api/v1/user/update; JSON body: {"server": "current_ip"}
|
|
curl -s -X PATCH https://astrocom.tel/api/v1/user/update -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" -d "{\"server\": \"$CURRENT_IP\"}" |