2024-06-19 04:35:24 -04:00
API_HOST = "https://api.ssh.surf"
2024-08-02 02:03:50 -04:00
API_KEY = $( cat /var/tools/container-expire-notifs/.api-key)
2024-06-19 04:35:24 -04:00
2024-07-26 09:06:41 -04:00
if [ ! $API_KEY ] ; then
notif "API key not found. Please re-run \`/enable-expire-notifs\`"
exit 1
fi
hello = $( curl -w %{ http_code} -sH " x-ssh-auth: $API_KEY " $API_HOST /hello -o /dev/null)
if [ [ hello -ne 200 ] ] ; then
notif "API key not valid. Please re-run \`/enable-expire-notifs\`"
exit 1
fi
2024-06-19 04:35:24 -04:00
notif "Hello, your container at SSH.SURF has hit its expire date, if not extended before 6PM EST the container will be removed automatically. Use /extend to gain another 7 days."
date = $( curl -sH " x-ssh-auth: $API_KEY " $API_HOST /time | grep -o '"expireDate":"[^"]*' | grep -o '[^"]*$' )
2024-08-16 03:02:12 -04:00
at -t $( date -d $date +'%Y%m%d%H%M' -d " $end_date +6 days " ) -f /var/tools/container-expire-notifs/notify.sh