#!/bin/bash
#
# Set up Configuration File and Destination File
#
CONFIG_FILE=/home/kensipe/sbin/data.d/Files_To_Backup
FILE=archive.tar.gz
DESTINATION=/home/kensipe/sbin/data.d/$FILE
#
# Main Script Starts
############################################################
# Read Config File
#
#
FILE_NO=1
exec < $CONFIG_FILE
while read FILE_NAME #Start reading config file
do
if [ -f $FILE_NAME -o -d $FILE_NAME ]
then
echo
FILE_LIST="$FILE_LIST $FILE_NAME"
else
echo "File does not exist"
echo "File: $FILE_NAME missing in on Line: $FILE_NO"
fi
FILE_NO=$[ $FILE_NO + 1 ]
done
#############################################################
# Back up Files
#
echo
echo "Archiving..."
tar -czf $DESTINATION $FILE_LIST 2> /dev/null
echo
echo "Files Archived: $DESTINATION"
No comments:
Post a Comment