#!/bin/bash
#
# used in archive directory
YEAR=$(date +%Y)
MONTH=$(date +%m)
DAY=$(date +%d)
# used in archive file name
TIME=$(date +%H%M%S)
# read files to be backed up
CONFIG_FILE=/homeb/d54712/sandbox/scripts/data.d/Files_To_Backup
# Base destination path (augmented with archive directory
BASE_DEST=/homeb/d54712/sandbox/scripts/data.d
# Archive File name
AR_FILE=$TIME.tar.gz
# make archive directory
mkdir -p $BASE_DEST/$YEAR/$MONTH/$DAY
# Backup Destination
DESTINATION=$BASE_DEST/$YEAR/$MONTH/$DAY/$AR_FILE
echo "Year: $YEAR"
echo "Month: $MONTH"
echo "Day: $DAY"
echo "Time: $TIME"
echo "Configuration File: $CONFIG_FILE"
echo "Base Destination: $BASE_DEST"
echo "AR_FILE: $AR_FILE"
echo "Archive File: $DESTINATION"
Result:
#debug
$ ./read3.sh
Year: 2017
Month: 03
Day: 29
Time: 105105
Configuration File: /homeb/d54712/sandbox/scripts/data.d/Files_To_Backup
Base Destination: /homeb/d54712/sandbox/scripts/data.d
AR_FILE: 105105.tar.gz
Archive File: /homeb/d54712/sandbox/scripts/data.d/2017/03/29/105105.tar.gz
No comments:
Post a Comment