#! /bin/sh
#
# @(#)startMC	1.5	LPS_UNX_COM	2/19/95
#
# Copyright 1993   Digital Equipment Corporation, Maynard, MA
#
# restartMC
#
# Startup a new Management Client daemon or restart an existing daemon.
#
# Parameters:
#    $1 - Name of the Management Client object.
#
# Global variables:
#    DAEMONUID
#    ECHON
#    ENV_LPSBIN
#    TMPDIR
#
# Exit values:
#    0 - Success, daemon was either started or restarted.
#    1 - Failure of some kind, error messages to stderr.
###

MCNAME=$1

logfile=$TMPDIR/${MCNAME}.n

$ECHON "Starting Management Client \"$MCNAME\"..."

if $ENV_LPSBIN/lpsad -M $MCNAME > $logfile 2>&1
then
    echo "done."
    rm $logfile
    exit 0
fi

$PAGER << END_OF_INPUT

    There appears to be a problem with starting the Management Client
    daemon.  Please investigate and correct the problem.  Following is the
    current contents of the log file written by the Management Client;
    examine the end of the file for the most recent output:

`cat $logfile`
END_OF_INPUT

echo
echo "These errors can be found in the file: $logfile"
echo

pause

exit 1
