-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy_db.sh
More file actions
executable file
·35 lines (26 loc) · 1.17 KB
/
copy_db.sh
File metadata and controls
executable file
·35 lines (26 loc) · 1.17 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
#!/bin/bash
# Script to copy GT.M database backups to NAS.
#
log=/var/log/$(basename $0 .sh).log
SERVER=playpen
DATE=$(/bin/date "+%Y%m%d")
SOURCE=/home/osehra/G
DESTINATION=/var/nas/rhs/${SERVER}/backup/${DATE}
echo "Begin" >> $log 2>&1
if [ ! -d $DESTINATION ] ; then
echo "Creating ${DESTINATION}..." >> $log 2>&1
mkdir -p ${DESTINATION} >> $log 2>&1
fi
if [ -d $DESTINATION ] ; then
date >> $log 2>&1
echo "Copy Files to NAS..." >> $log 2>&1
cp -avpf $SOURCE $DESTINATION >> $log 2>&1
date >> $log 2>&1
fi
if [ -d $DESTINATION ] ; then
date >> $log 2>&1
echo "Compressing database files..." >> $log 2>&1
gzip ${DESTINATION}/*.dat >> $log 2>&1
date >> $log 2>&1
fi
echo "Done" >> $log 2>&1