Skip to content

Instantly share code, notes, and snippets.

@stokito
Last active January 16, 2021 21:45
Show Gist options
  • Save stokito/4a145d73402946ba6ec8d3a3ca83e1ae to your computer and use it in GitHub Desktop.
Save stokito/4a145d73402946ba6ec8d3a3ca83e1ae to your computer and use it in GitHub Desktop.
htpdate service on busybox httpd. Put the script to /cgi-bin/date.sh and call it like curl http://localhost:8080/cgi-bin/date.sh -v
#!/bin/sh
# This is run once a day - don't care about performance
# RFC date must have GMT in the end
# but GNU date return +0000 instead and bb date returns UTC
# So we must strip +0000 or UTC and add GMT ourselves
DATE=$(date -R -u | sed 's/\UTC/GMT/' | sed 's/\+0000/GMT/')
echo "Date: $DATE\nStatus: 200\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment