Datemaker

From V.S.V., Inc.
Jump to: navigation, search

This is a handy script that I use daily for creating the timestamp for use with TinyDNS. You just put in the time in 24 hour format and the date for when the TinyDNS record will become active and it returns it in the tai64 format.

This allows for scheduling of updates such as when deactivating a DNS entry or changing the address. In this manner TTLs are updated correctly since TinyDNS correctly handles time to die entries.

Example: $ ./datemaker “20:00 tomorrow”
Mon Dec 13 20:00:00 EST 2010
400000004d06c190

#!/bin/bash
#
# datemaker v1.0.0
#
# this takes a human readable date as an argument
# and converts that into a format used by tinydns

if [ "" == "$1" ] ; then
echo “Requires gnudate-style time as argument”
exit 98
fi

Return to: Main

when=$1
date –date=”$when”
date –date=”$when” +”16o2 62^%s+2 32^*p” | \
dc | tr A-Z a-z | cut -c1-16