#!/bin/sh
#
# Script to start up the memory tester may be run from cron in the eve.
#
# Typical crontab entries to start at 10:00 PM & stop at 6:00 AM (64MB):
# 00 22 * * * /usr/local/src/memtst/memtst-start 64
# 00 06 * * * /usr/local/src/memtst/memtst-stop person@host.subdom.domain
#
PATH=:/usr/local/bin:/usr/ucb:/usr/bin:/usr/etc:
#
# Default # of megs checked 
#

DEFMEGS=16
PMEM=${1:-$DEFMEGS}

#
# The following have to jibe with the ones in memtst-stop.
# PIDFILE should be left in /tmp so that the code in memtst-stop
# properly detects a reboot (/tmp is cleared on reboot). OUTFILE
# is the output from memtst and should be kept on a real disk partition
# which survives a reboot (/usr/tmp).
#

PIDFILE=/tmp/memtst.pid
OUTFILE=/usr/tmp/memtst.out

#

if [ -f $PIDFILE ]
then
  echo "memtst is already running, $PIDFILE exists"
  exit
fi
memtst $PMEM > $OUTFILE &
echo $! > $PIDFILE
