#!/bin/sh
###
# This program was written by and is copyright Alec Muffett 1991,
# 1992, 1993, 1994, 1995, and 1996, and is provided as part of the
# Crack v5.0 Password Cracking package.
#
# The copyright holder disclaims all responsibility or liability with
# respect to its usage or its effect upon hardware or computer
# systems, and maintains copyright as set out in the "LICENCE"
# document which accompanies distributions of Crack v5.0 and upwards.
###
# this script can be arbitrarily hacked in order to put Crack to
# sleep; the logic is a bit inverted so that it can be hacked to use a
# variety of poll times.

exec </dev/null >/dev/null 2>&1

POLL=60
LOCKFILE="GOTO-SLEEP"

###
# Write out a datestamp
###
#date >> STAMP

while :
do

###
# Sleep infinitely, whilst there exists a lockfile in $CRACK_HOME
###
	if [ -f $LOCKFILE ]
	then
		sleep $POLL
		continue
	fi

###
# Leave the CPU alone when Gilly's logged on playing tetris
###
#	if who | egrep '^gilly'
#	then
#		sleep $POLL
#		continue
#	fi

###
# Go to sleep between 0800 and 1759 inclusive, except weekends
###
#	set `date '+%H %w'`	# $1=hour(00..23) $2=day(0..6)
#
#	if [ "$1" -ge 8 -a "$1" -le 17 -a "$2" -ge 1 -a "$2" -le 5 ]
#	then
#		sleep $POLL
#		continue
#	fi

	break		# like, y'know, totally gross, man...
done

exit 0
