#!/bin/sh
#
# fwcolor_allocate -- convenient script to start/stop windu_clientd
#

# must set FWCLIDIR
if [ -z "$FWCLIDIR" ]; then
echo "Error: Please set FWCLIDIR enviroment before you run this command"
exit 1
fi

# syntax
if [ $# -lt 1 -o "$1" != "stop" -a "$1" != "start" ]; then
echo "Usage: fwcolor_allocate stop|start [-display HOSTNAME:0]"
exit 1
fi

# check whether windu_clientd is there and is executable
if [ ! -x $FWCLIDIR/clients/lib/windu_clientd ]; then
echo "Error: $FWCLIDIR/clients/lib/windu_clientd is not there or does not have the right permission."
exit 1
fi
 
# determine whether to stop or start
if [ "$1" = "stop" ]; then
shift
$FWCLIDIR/clients/lib/windu_clientd -forceexit $@
exit 0
fi

if [ "$1" = "start" ]; then
shift
$FWCLIDIR/clients/lib/windu_clientd $@
exit 0
fi

