#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# artex720 src/artex/usr/sbin/snap/artex.sh 1.3 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2010 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)88        1.3  src/artex/usr/sbin/snap/artex.sh, artex, artex720 11/16/10 06:07:51
unset ARTEX_CATALOG_PATH
if [ "$PASSNO" = 1 ]
then
    echo "Checking space requirement for ARTEX information...\c" >> $SCRIPTLOG
else
    echo "Gathering  ARTEX information...\c" >> $SCRIPTLOG
fi

if [ "$PASSNO" = 1 ]
then
    total_bytes=`/usr/sbin/artexget -r /etc/security/artex/samples/default.xml | wc  -c `
    echo "$total_bytes" > $SCRIPTSIZE
    echo "Artex first pass reporting size= $total_bytes" >> $SCRIPTLOG
    exit 0
#end of first pass
fi

# Second pass,  return without error on first pass
if [[ -z $SNAPDIR ]]
then
    echo "ERROR: the script directory was not created  " >> $SCRIPTLOG
    exit 1
fi

total_bytes=`/usr/sbin/artexget -r /etc/security/artex/samples/default.xml >$SNAPDIR/artex.out 2>$SNAPDIR/artex.err`

echo " Artex Log file." >> $SCRIPTLOG
cat /var/adm/ras/artex/artex.log >> $SCRIPTLOG
echo " done." >> $SCRIPTLOG

