#!/bin/bash
#
# by: Forrest (20101203)
#
# Setup script for the process lab
# This script is to be installed and run on serverX.example.com
# Output is logged to syslog

# Set environment and declare global variables
. /usr/local/lib/labtool.shlib
trap on_exit EXIT
LOG_FACILITY=local0
LOG_PRIORITY=info
LOG_TAG=processes
DEBUG=false
ERROR_MESSAGE="Error running script. Contact your instructor if you continue to see this message."
PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
userInput="no"
set -o pipefail

# Check to make sure we are running as root
check_root

# Check to make sure we are running on the correct host
check_host "server"

# Kill processes if they exist
killall -q elephant hippo process101

# Start processes
(at -f /usr/local/sbin/monitor-lab now 2>&1 | log) || exit

echo "done!"

exit 0
