#!/bin/bash # uptime.sh — uptime in seconds + days. URL='YOUR_URL/uptime' SECS=$(cat /proc/uptime | awk '{print int($1)}') DAYS=$(awk "BEGIN { printf \"%.2f\", $SECS / 86400 }") curl -fsS -m 15 -H 'Content-Type: application/json' \ --data-raw "{\"hostname\": \"$(hostname)\", \"uptime_seconds\": $SECS, \"uptime_days\": $DAYS}" \ "$URL"