progress
This commit is contained in:
parent
00ac1d95f9
commit
59eb06fd58
@ -1 +1 @@
|
||||
0.1.7
|
||||
0.1.8
|
||||
|
||||
59
utils/move_archives.sh
Executable file
59
utils/move_archives.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
function usage {
|
||||
echo "Usage: ${0} [<from_host> (default: cloud11)]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
FromHost=${1}
|
||||
if [ "${FromHost}" == "" ]
|
||||
then
|
||||
FromHost=cloud11
|
||||
fi
|
||||
|
||||
echo Starting $0 $*
|
||||
|
||||
ArchiveDir=/home/cvtt/prod/archive
|
||||
Target=cloudstore.cvtt.vpn:/home/cvtt/Archive/${FromHost}/
|
||||
|
||||
# DateCriteria="week ago"
|
||||
DateCriteria="2 days ago"
|
||||
|
||||
Oldest=$(date -d "${DateCriteria}" '+%Y-%m-%d')
|
||||
Now=$(date '+%Y%m%d_%H%M%S')
|
||||
|
||||
echo "Looking for log files older than ${DateCriteria} in ${ArchiveDir}"
|
||||
Cmd="find ${ArchiveDir}/"
|
||||
Cmd="${Cmd} '('"
|
||||
Cmd="${Cmd} -name '*.log'"
|
||||
Cmd="${Cmd} -o -name '*.log.*'"
|
||||
Cmd="${Cmd} -o -name '*.logs.*'"
|
||||
Cmd="${Cmd} -o -name '*.tgz'"
|
||||
Cmd="${Cmd} ')'"
|
||||
Cmd="${Cmd} -type f"
|
||||
Cmd="${Cmd} -not -newermt ${Oldest}"
|
||||
|
||||
echo ${Cmd}
|
||||
files=$(eval ${Cmd})
|
||||
|
||||
if [ "$files" == "" ]
|
||||
then
|
||||
echo "No files found older than ${Oldest} in ${LogDir}"
|
||||
else
|
||||
echo Archiving files:
|
||||
echo -----------------
|
||||
for f in ${files}
|
||||
do
|
||||
echo ${f}
|
||||
done
|
||||
|
||||
Cmd="rsync -ahvv"
|
||||
Cmd="${Cmd} --remove-source-files"
|
||||
Cmd="${Cmd} $files"
|
||||
Cmd="${Cmd} ${Target}"
|
||||
echo ${Cmd}
|
||||
# exit
|
||||
eval ${Cmd}
|
||||
fi
|
||||
echo Done ${0} ${*}
|
||||
Loading…
x
Reference in New Issue
Block a user