#!/usr/bin/ruby

require 'socket'
require 'digest/sha1'

# Seed the random number generator with the hostname of this box so that
# we get a consistent random number.  We want to run the registration at a
# consistent time on each individual box, but randomize the runs across
# the environment.
srand(Digest::SHA1.hexdigest(Socket.gethostname)[0,7].hex)

# Cron job is set to run every hour
MAX_SLEEP = 60 * 60

sleep(rand(MAX_SLEEP))

exec('/usr/sbin/etch', '--generate-all')

