#!/bin/bash
# ************************************************************
# *
# * Name: WRITSNAP
# *
# * Desc: Write a snapshot to the ../snapshot subdirectory
# *       The hercules engine must be shut down when running
# *       this script
# *
# ************************************************************
PATH=../hercules:${PATH}
THISDIR=`pwd`
cd ..
GENDIR=`pwd`
cd ${THISDIR}

if ! test -d ../snapshot
then
  mkdir ../snapshot
fi
echo Saving snapshot $1

if test -f ../dasd/start1.150
then
   tar -vcz -f ../snapshot/snap${1}_start1.tgz    ../dasd/start1.150
fi

rm -f ../snapshot/snap${1}_spool0.tgz
tar -vcz -f ../snapshot/snap${1}_spool0.tgz    ../dasd/spool*.*

if test -f ../dasd/mvsres.148
then
   tar -vcz -f ../snapshot/snap${1}_mvsres.tgz    ../dasd/mvsres.148
fi

if test -f ../dasd/mvsdlb.248
then
   tar -vcz -f ../snapshot/snap${1}_mvsdlb.tgz    ../dasd/mvsdlb.248
fi

if test -f ../dasd/pub000.240
then
   tar -vcz -f ../snapshot/snap${1}_pub000.tgz    ../dasd/pub000.240
fi

if test -f ../dasd/pub001.241
then
   tar -vcz -f ../snapshot/snap${1}_pub001.tgz    ../dasd/pub001.241
fi
