fix syntax error in syncHttpLogs causing it to fail on log01. File needed } at the end of variable. Consolidated debug statements
This commit is contained in:
parent
0b47d5df4c
commit
c1c1905ce4
1 changed files with 5 additions and 9 deletions
|
@ -1,13 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
RSYNC_FLAGS='-avSHP --no-motd'
|
RSYNC_FLAGS='-avSHP --no-motd'
|
||||||
DEBUG=0
|
DEBUG=1
|
||||||
|
|
||||||
function syncHttpLogs {
|
function syncHttpLogs {
|
||||||
|
|
||||||
# in case we missed a run or two.. try to catch up the last 3 days.
|
# in case we missed a run or two.. try to catch up the last 3 days.
|
||||||
for d in 1 2 3
|
for d in 1 2 3; do
|
||||||
do
|
|
||||||
HOST=$1
|
HOST=$1
|
||||||
# some machines store stuff in old format. some new.
|
# some machines store stuff in old format. some new.
|
||||||
if [ "$2" = "old" ]; then
|
if [ "$2" = "old" ]; then
|
||||||
|
@ -21,14 +20,11 @@ function syncHttpLogs {
|
||||||
/bin/mkdir -p /var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/http
|
/bin/mkdir -p /var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/http
|
||||||
cd /var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/http/
|
cd /var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/http/
|
||||||
|
|
||||||
RSYNC_OUTPUT=$(/usr/bin/rsync $RSYNC_FLAGS --list-only $HOST::log/httpd/*$YESTERDAY* | awk '{ print $5 }' | grep log )
|
RSYNC_OUTPUT=$(/usr/bin/rsync $RSYNC_FLAGS --list-only $HOST::log/httpd/*$YESTERDAY* | grep xz$ | awk '{ print $5 }' )
|
||||||
if [[ ${DEBUG} -eq 1 ]]; then
|
|
||||||
echo ${RSYNC_OUTPUT}
|
|
||||||
fi
|
|
||||||
for f in ${RSYNC_OUTPUT}; do
|
for f in ${RSYNC_OUTPUT}; do
|
||||||
DEST=$(echo $f | /bin/sed s/-$YESTERDAY//)
|
DEST=$(echo $f | /bin/sed s/-$YESTERDAY//)
|
||||||
if [[ ${DEBUG -eq 1 ]]; then
|
if [[ ${DEBUG} -eq 1 ]]; then
|
||||||
echo ${DEST}
|
echo "${HOST}: Getting ${RSYNC_OUTPUT} and saving to ${DEST}"
|
||||||
fi
|
fi
|
||||||
/usr/bin/rsync $RSYNC_FLAGS $HOST::log/httpd/$f ./$DEST &> /dev/null
|
/usr/bin/rsync $RSYNC_FLAGS $HOST::log/httpd/$f ./$DEST &> /dev/null
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue