-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaily_Archive
More file actions
66 lines (48 loc) · 1.13 KB
/
daily_Archive
File metadata and controls
66 lines (48 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/bash
# Daily Archive - Archive designated files and directoies
DATE=$(date +%y%m%d)
FILE=archive$DATE.tar.gz
# config file and destination file
CONFIG_FILE=/archive/Files_To_Backup
DESTINATION=/archive/$FILE
########MAIN SCRIPT##########
if [ -f $CONFIG_FILE ]
then
echo
else
echo
echo "$CONFIG_FILE does not exist"
echo "Backup not completed due to missing Configuration File"
echo
exit
fi
# Building the names of all files to backup
FILE_NO=1
exec < $CONFIG_FILE
read FILE_NAME
while [ $? -eq 0 ]
do
if [ -f $FILE_NAME -o -d $FILE_NAME ]
then
FILE_LIST="$FILE_LIST $FILE_NAME"
else
echo
echo "$FILE_NAME, does not exist."
echo "Obviously, I will not include it in this archive."
echo "It is not listed on line $FILE_NO of the config file."
echo "Continuing to build archive list..."
echo
fi
FILE_NO=$[$FILE_NO + 1]
read FILE_NAME
done
#######################################################
# Backup and Compressing Archive files
echo "Starting archive..."
echo
tar -czf $DESTINATION $FILE_LIST 2> /dev/null
echo
echo "Archive completed"
echo "Resulting archive file is : $DESTINATION"
echo
exit