2016-06-23 12:04:57 +00:00
|
|
|
#!/bin/sh
|
2016-07-07 05:00:21 +00:00
|
|
|
cd $(dirname $0)
|
|
|
|
|
2016-06-23 12:04:57 +00:00
|
|
|
set -e
|
2016-06-23 11:29:18 +00:00
|
|
|
FILE=random.1m
|
2016-07-07 05:00:21 +00:00
|
|
|
VERBOSE=${VERBOSE:-""}
|
2016-06-23 11:29:18 +00:00
|
|
|
|
|
|
|
# Create TEST File
|
2016-07-07 05:00:21 +00:00
|
|
|
MD5=$(dd if=/dev/urandom bs=10240 count=1024 2>/dev/null |tee ${FILE} |md5sum |awk '{print $1}')
|
2016-06-23 11:29:18 +00:00
|
|
|
SIZE=$(ls -l ${FILE}|awk '{print $5}')
|
2016-07-07 05:00:21 +00:00
|
|
|
TSMOPT="-VIRTUALNODENAME=TEST -PASSWORD=TEST -COMPRESSALWAYS=YES"
|
2016-06-23 11:29:18 +00:00
|
|
|
|
|
|
|
TSMPIPE=../tsmpipe
|
|
|
|
|
|
|
|
echo "MD5 of [${FILE}] is [${MD5}] (${SIZE})"
|
|
|
|
|
2016-07-07 05:00:21 +00:00
|
|
|
ln -fs /opt/tivoli/tsm/client/api/bin64/EN_US
|
2016-06-23 11:29:18 +00:00
|
|
|
export DSMI_DIR=./
|
2016-06-23 12:04:57 +00:00
|
|
|
export DSMI_CONFIG=dsm.opt
|
2016-06-23 11:29:18 +00:00
|
|
|
|
|
|
|
# Send file to TSM
|
2016-07-07 05:00:21 +00:00
|
|
|
echo "+++ TEST BACKUP ++++!"
|
|
|
|
echo "+ BACKUP: SEND FILE!"
|
|
|
|
cat ${FILE} | ${TSMPIPE} -Bcm MD5 -s /test -f ${FILE} ${VERBOSE} -l ${SIZE} -O"${TSMOPT}"
|
2016-06-23 11:29:18 +00:00
|
|
|
|
|
|
|
# Send a second time
|
2016-07-07 05:00:21 +00:00
|
|
|
echo "+ BACKUP: SEND FILE AGAIN!"
|
|
|
|
cat ${FILE} | ${TSMPIPE} -Bcm MD5 -s /test -f ${FILE} ${VERBOSE} -l ${SIZE} -O"${TSMOPT}"
|
2016-06-23 11:29:18 +00:00
|
|
|
|
|
|
|
# List it
|
2016-07-07 05:00:21 +00:00
|
|
|
echo "+ BACKUP: LIST FILE!"
|
|
|
|
${TSMPIPE} -Bts /test -f ${FILE} -O"${TSMOPT}"
|
2016-06-23 11:29:18 +00:00
|
|
|
|
|
|
|
# Get it back
|
2016-07-07 05:00:21 +00:00
|
|
|
echo "+ BACKUP: RETRIEVE FILE!"
|
|
|
|
${TSMPIPE} -Bxs /test -f ${FILE} ${VERBOSE} -O"${TSMOPT}" > ${FILE}.back
|
2016-06-23 11:29:18 +00:00
|
|
|
RETRIEVE=$(md5sum ${FILE}.back | awk '{print $1}')
|
|
|
|
if [ "${MD5}" != "${RETRIEVE}" ]; then
|
|
|
|
exit 1
|
|
|
|
else
|
2016-07-07 05:00:21 +00:00
|
|
|
echo "+ BACKUP: RETRIEVE VALID (${RETRIEVE})!"
|
2016-06-23 11:29:18 +00:00
|
|
|
fi
|
|
|
|
|
2016-07-07 05:00:21 +00:00
|
|
|
# Purge the last one
|
|
|
|
echo "+ BACKUP: PURGE!"
|
|
|
|
${TSMPIPE} -Bgs /test -f ${FILE} ${VERBOSE} -O"${TSMOPT}"
|
|
|
|
|
|
|
|
# List it
|
|
|
|
echo "+ BACKUP: LIST FILE IS PURGED!"
|
|
|
|
${TSMPIPE} -Bts /test -f ${FILE} -O"${TSMOPT}"
|
|
|
|
|
2016-06-23 11:29:18 +00:00
|
|
|
# Delete it
|
2016-07-07 05:00:21 +00:00
|
|
|
echo "+ BACKUP: DELETE!"
|
|
|
|
${TSMPIPE} -Bds /test -f ${FILE} ${VERBOSE} -O"${TSMOPT}"
|
|
|
|
|
|
|
|
# List it
|
|
|
|
echo "+ BACKUP: LIST FILE IS DELETED!"
|
|
|
|
${TSMPIPE} -Bts /test -f ${FILE} -O"${TSMOPT}"
|
|
|
|
echo "+++ END BACKUP ++++!"
|
|
|
|
|
|
|
|
echo "+++ TEST ARCHIVE ++++!"
|
|
|
|
echo "+ ARCHIVE: SEND FILE!"
|
|
|
|
cat ${FILE} | ${TSMPIPE} -Acm MD5 -s /test -f ${FILE} ${VERBOSE} -l ${SIZE} -D"Test Archive File" -O"${TSMOPT}"
|
|
|
|
|
|
|
|
# Send a second time
|
|
|
|
echo "+ ARCHIVE: SEND FILE AGAIN! (delay)"
|
|
|
|
sleep 2
|
|
|
|
cat ${FILE} | ${TSMPIPE} -Acm MD5 -s /test -f ${FILE} ${VERBOSE} -l ${SIZE} -D"Test Archive File" -O"${TSMOPT}"
|
|
|
|
DATE=$(date +%m%d%Y:%H%M%S)
|
|
|
|
|
|
|
|
# List it
|
|
|
|
echo "+ ARCIHVE: LIST FILE!"
|
|
|
|
${TSMPIPE} -Ats /test -f ${FILE} -O"${TSMOPT}"
|
|
|
|
|
|
|
|
# Get it back
|
|
|
|
echo "+ ARCIHVE: RETRIEVE FILE! (${DATE})"
|
|
|
|
${TSMPIPE} -Axs /test -f ${FILE} -n ${DATE} ${VERBOSE} -O"${TSMOPT}" > ${FILE}.back
|
|
|
|
RETRIEVE=$(md5sum ${FILE}.back | awk '{print $1}')
|
|
|
|
if [ "${MD5}" != "${RETRIEVE}" ]; then
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "+ ARCHIVE: RETRIEVE VALID (${RETRIEVE})!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Purge the last one
|
|
|
|
echo "+ ARCHIVE: DELETE!"
|
|
|
|
${TSMPIPE} -Ads /test -f ${FILE} -n ${DATE} ${VERBOSE} -O"${TSMOPT}"
|
|
|
|
|
|
|
|
# List it
|
|
|
|
echo "+ ARCHIVE: LIST FILE AFTER DELETE!"
|
|
|
|
${TSMPIPE} -Ats /test -f ${FILE} -O"${TSMOPT}"
|
|
|
|
echo "+++ END ARCHIVE ++++!"
|
2016-06-23 11:29:18 +00:00
|
|
|
|
|
|
|
rm -f EN_US ${FILE} ${FILE}.back
|