Skip to content

Commit 4e4823b

Browse files
author
Christopher M. Neill
committed
double-quote variables
1 parent e83eae6 commit 4e4823b

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

ansible/roles/loggly/files/archiveOldLogs.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ datetime=`date +%Y%m%d%H%m`
1818

1919
# these logfiles haven't been modified in > 24 hours, so moving them without cleanup up filehandles first should be OK:
2020
echo "Compressing logs > 24h"
21-
find ${logdir} -maxdepth 2 -type f -mmin +1440 -name '*.log' -exec bzip2 -9 {} \; -print
21+
find "${logdir}" -maxdepth 2 -type f -mmin +1440 -name '*.log' -exec bzip2 -9 {} \; -print
2222
echo "Restarting rsyslogd"
2323
# but we do need to clean the filehandles after, just in case
2424
service rsyslog restart
2525

2626
# archive anything > 6h
2727
echo "Archiving logs > 6h"
28-
mkdir -p ${archdir} 2>&1
29-
find ${logdir} -maxdepth 2 -type f -mtime +6 -name '*z' | xargs tar jcvpf ${archdir}/log-archive-${datetime}.tbz
28+
mkdir -p "${archdir}" 2>&1
29+
find "${logdir}" -maxdepth 2 -type f -mtime +6 -name '*z' | xargs tar jcvpf "${archdir}"/log-archive-"${datetime}".tbz
3030
echo "Purging logs > 1wk"
31-
find ${logdir} -maxdepth 2 -type f -mtime +6 -exec rm -f {} \; -print
31+
find "${logdir}" -maxdepth 2 -type f -mtime +6 -exec rm -f {} \; -print

ansible/roles/loggly/files/purgeLogs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# Runs from crontab.
66
#
77

8-
logdir=${1}
8+
logdir="${1}"
99

1010
# We can compress anything older than 6 hours
11-
find ${logdir} -mindepth 2 -type f -mmin +360 -name '*.log' -exec bzip2 -9 {} \;
11+
find "${logdir}" -mindepth 2 -type f -mmin +360 -name '*.log' -exec bzip2 -9 {} \;
1212

1313
# We automatically purge anything > 1wk
14-
find ${logdir} -maxdepth 2 -type f -mtime +7 -exec rm -f {} \;
14+
find "${logdir}" -maxdepth 2 -type f -mtime +7 -exec rm -f {} \;

0 commit comments

Comments
 (0)