#!/bin/sh

# SETTINGS
ID=YOURID
PASS=YOURPASS
PATH=/bin:/sbin:/usr/bin:/usr/sbin

# GET INFORMATION
UPTIME=$(sysctl -n kern.boottime | awk -F= '{print $3}' | awk -F\} '{print $1}' | xargs)
PROD_VERSION=$(sw_vers -productVersion)
PROD_NAME=$(sw_vers -productName)
KERNEL=$(uname -or)
CPU=$(sysctl -a | grep machdep.cpu.brand_string | awk -F': ' '{print $2}' | xargs)
OS="${PROD_NAME} ${PROD_VERSION} (${KERNEL}) - ${CPU}"
HOST=$(hostname)

# CALL API
curl -s --get \
  --data-urlencode "ID=${ID}" \
  --data-urlencode "UPTIME=${UPTIME}" \
  --data-urlencode "OS=${OS}" \
  --data-urlencode "PASS=${PASS}" \
  --data-urlencode "HOST=${HOST}" \
  https://horst.dyndns.org/api/update
