Skip to content

Instantly share code, notes, and snippets.

@escowles
Created May 18, 2020 12:45
Show Gist options
  • Save escowles/a10ea48f7cbe5300000ded290809387b to your computer and use it in GitHub Desktop.
Save escowles/a10ea48f7cbe5300000ded290809387b to your computer and use it in GitHub Desktop.
#!/bin/sh
URL=${1:-https://catalog.princeton.edu}
EXP=`curl --insecure -v $URL 2>&1 | grep "* expire date" | sed -e's/* expire date: //'`
EXP_S=`date -j -f "%B %e %H:%M:%S %Y %Z" +%s "$EXP"`
NOW_S=`date +%s`
echo $URL: $(( ($EXP_S - $NOW_S) / (3600*24) )) days until expiration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment