summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spragg <adam@spragg-ssl.co.uk>2018-08-09 19:11:41 +0100
committerAdam Spragg <adam@spragg-ssl.co.uk>2018-08-09 19:11:41 +0100
commitec1a2cb73fdf7346a47330b4cd7d0c9b3f7143b0 (patch)
tree5dcbb1893e1e655ad59d82561ab9d459216cc386
parent4dd62a4934ca72a9ee6842da347408a28c5d490c (diff)
Consistently quote and use "{"/"}" with shell variables
-rwxr-xr-xdaily.sh22
-rwxr-xr-xhourly.sh6
2 files changed, 14 insertions, 14 deletions
diff --git a/daily.sh b/daily.sh
index 27636f8..ffd34b5 100755
--- a/daily.sh
+++ b/daily.sh
@@ -1,10 +1,10 @@
#! /bin/sh
DOMAIN="spragg-ssl.co.uk"
-SITEROOT="/srv/www/$DOMAIN"
+SITEROOT="/srv/www/${DOMAIN}"
DATE=`/bin/date +%Y-%m-%d`
-LOGFILE="$SITEROOT/log/updates.$DATE.log"
+LOGFILE="${SITEROOT}/log/updates.${DATE}.log"
TSFMT="%b %d %H:%M:%S"
AWYEAR=`/bin/date -d yesterday +%Y`
@@ -12,20 +12,20 @@ AWMON=`/bin/date -d yesterday +%m`
# Delete any logs older than 30 days
-/usr/bin/find "$SITEROOT/log" -name "*.log" -mtime +30 -delete 2>&1 | /usr/bin/ts "$TSFMT find:" >>$LOGFILE
+/usr/bin/find "${SITEROOT}/log" -name "*.log" -mtime +30 -delete 2>&1 | /usr/bin/ts "${TSFMT} find:" >>"${LOGFILE}"
# Run awstats
-$SITEROOT/awstats/awstats -config="$DOMAIN" -update 2>&1 | /usr/bin/ts "$TSFMT awstats:" >>$LOGFILE
+${SITEROOT}/awstats/awstats -config="${DOMAIN}" -update 2>&1 | /usr/bin/ts "${TSFMT} awstats:" >>"${LOGFILE}"
# Remove any PII (i.e. IP addresses) from the awstats data
-AWDATA="$SITEROOT/awstats/data/awstats${AWMON}${AWYEAR}.txt"
-/bin/grep -E -v "^[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3} [[:digit:]]" "$AWDATA" \
+AWDATA="${SITEROOT}/awstats/data/awstats${AWMON}${AWYEAR}.txt"
+/bin/grep -E -v "^[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3} [[:digit:]]" "${AWDATA}" \
| /bin/sed -e "s/^BEGIN_VISITOR [[:digit:]]\\+\$/BEGIN_VISITOR 0/" \
- | /usr/bin/sponge "$AWDATA"
+ | /usr/bin/sponge "${AWDATA}"
/usr/share/awstats/tools/awstats_buildstaticpages.pl \
- -awstatsprog="$SITEROOT/awstats/awstats" \
- -config="$DOMAIN" -dir="$SITEROOT/awstats/html" \
- -year="$AWYEAR" -month="$AWMONTH" \
- 2>&1 | /usr/bin/ts "$TSFMT awstats_buildstaticpages.pl:" >>$LOGFILE
+ -awstatsprog="${SITEROOT}/awstats/awstats" \
+ -config="${DOMAIN}" -dir="${SITEROOT}/awstats/html" \
+ -year="${AWYEAR}" -month="${AWMONTH}" \
+ 2>&1 | /usr/bin/ts "${TSFMT} awstats_buildstaticpages.pl:" >>"${LOGFILE}"
diff --git a/hourly.sh b/hourly.sh
index c865435..8fb7b62 100755
--- a/hourly.sh
+++ b/hourly.sh
@@ -1,12 +1,12 @@
#! /bin/sh
DOMAIN="spragg-ssl.co.uk"
-SITEROOT="/srv/www/$DOMAIN"
+SITEROOT="/srv/www/${DOMAIN}"
DATE=`/bin/date +%Y-%m-%d`
-LOGFILE="$SITEROOT/log/updates.$DATE.log"
+LOGFILE="${SITEROOT}/log/updates.${DATE}.log"
TSFMT="%b %d %H:%M:%S"
# Update rawdog
-/usr/bin/rawdog --dir "$SITEROOT/rawdog" --update --write 2>&1 | /usr/bin/ts "$TSFMT rawdog:" >>$LOGFILE
+/usr/bin/rawdog --dir "${SITEROOT}/rawdog" --update --write 2>&1 | /usr/bin/ts "${TSFMT} rawdog:" >>"${LOGFILE}"