better logging

This commit is contained in:
Nathaniel Landau
2015-01-03 12:33:36 -05:00
parent 5057a9975b
commit 1757ee89c8

View File

@@ -120,13 +120,9 @@ function configFile() {
# CONFIG FILE FOR $SCRIPTNAME
# CREATED ON $NOW
#
# Created by version "$VERSION" of "$SCRIPTNAME"
# Created by version "$VERSION" of "SyncTemplate.sh"
# ##################################################
# ---------------------------
# BASE CONFIGURATION
# ---------------------------
# METHOD
# ---------------------------
# This script will work with both Unison and rsync.
@@ -154,6 +150,7 @@ MOUNTPOINT=""
REMOTEVOLUME=""
# ---------------------------
# Directories To Sync
# ---------------------------
# These are the COMPLETE paths two directories that will be synced.
@@ -161,6 +158,7 @@ REMOTEVOLUME=""
SOURCEDIRECTORY=""
TARGETDIRECTORY=""
# ---------------------------
# UNISON PREFERENCES
# ---------------------------
@@ -328,7 +326,7 @@ function mainScript() {
die "We were missing the Unison Profile. Could not sync."
fi
# Run unison with the profile
echo "$NOW - Beginning Unison Sync" >> "$LOGFILE"
echo "$NOW - Beginning Unison with command: unison $UNISONPROFILE" >> "$LOGFILE"
unison "$UNISONPROFILE"
else
if [ "$USEPROFILE" = "true" ]; then
@@ -338,11 +336,11 @@ function mainScript() {
die "We were missing the Unison Profile. Could not sync."
fi
# Run unison with a profile
echo "$NOW - Beginning Unison Sync" >> "$LOGFILE"
echo "$NOW - Beginning Unison with command: unison $UNISONPROFILE $SOURCEDIRECTORY $TARGETDIRECTORY" >> "$LOGFILE"
unison "$UNISONPROFILE" "$SOURCEDIRECTORY" "$TARGETDIRECTORY"
else
# Run Unison without a profile
echo "$NOW - Beginning Unison Sync" >> "$LOGFILE"
echo "$NOW - Beginning Unison with command: unison $SOURCEDIRECTORY $TARGETDIRECTORY" >> "$LOGFILE"
unison "$SOURCEDIRECTORY" "$TARGETDIRECTORY"
fi
fi
@@ -351,6 +349,8 @@ function mainScript() {
# Unmount the drive (if mounted)
if [ "$NEEDMOUNT" = "true" ] || [ "$NEEDMOUNT" = "TRUE" ]; then
unmountDrive "$REMOTEVOLUME"
echo "$NOW - $REMOTEVOLUME Unmounted" >> "$LOGFILE"
e_success "$REMOTEVOLUME UnMounted"
fi
# Time the script by logging the end time