#!/bin/sh

# This hook sets the last_commit_date for isi_licensing purposes. We only want
# to run this once per cluster - hook patterns are the way to go

LOCKFILE=/ifs/.ifsvar/LICENSE_EPOCH_LOCK


case $# in
    0)
		if [ ! -f $LOCKFILE ]; then
			exec lockf -k $LOCKFILE $0 under-lock
		fi
        ;;
    1)
		HOSTNAME=`hostname`
		echo $HOSTNAME setting epoch
		/usr/bin/python -c 'import time;
import isi.config.licensing;
isi.config.licensing.set_last_commit_epoch(time.time())' || exit 1
		echo $HOSTNAME set epoch
		;;
esac

