mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-10 06:03:47 -05:00
better logging
This commit is contained in:
@@ -120,13 +120,9 @@ function configFile() {
|
|||||||
# CONFIG FILE FOR $SCRIPTNAME
|
# CONFIG FILE FOR $SCRIPTNAME
|
||||||
# CREATED ON $NOW
|
# CREATED ON $NOW
|
||||||
#
|
#
|
||||||
# Created by version "$VERSION" of "$SCRIPTNAME"
|
# Created by version "$VERSION" of "SyncTemplate.sh"
|
||||||
# ##################################################
|
# ##################################################
|
||||||
|
|
||||||
# ---------------------------
|
|
||||||
# BASE CONFIGURATION
|
|
||||||
# ---------------------------
|
|
||||||
|
|
||||||
# METHOD
|
# METHOD
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# This script will work with both Unison and rsync.
|
# This script will work with both Unison and rsync.
|
||||||
@@ -154,6 +150,7 @@ MOUNTPOINT=""
|
|||||||
REMOTEVOLUME=""
|
REMOTEVOLUME=""
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
# Directories To Sync
|
# Directories To Sync
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# These are the COMPLETE paths two directories that will be synced.
|
# These are the COMPLETE paths two directories that will be synced.
|
||||||
@@ -161,6 +158,7 @@ REMOTEVOLUME=""
|
|||||||
SOURCEDIRECTORY=""
|
SOURCEDIRECTORY=""
|
||||||
TARGETDIRECTORY=""
|
TARGETDIRECTORY=""
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# UNISON PREFERENCES
|
# UNISON PREFERENCES
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
@@ -328,7 +326,7 @@ function mainScript() {
|
|||||||
die "We were missing the Unison Profile. Could not sync."
|
die "We were missing the Unison Profile. Could not sync."
|
||||||
fi
|
fi
|
||||||
# Run unison with the profile
|
# Run unison with the profile
|
||||||
echo "$NOW - Beginning Unison Sync" >> "$LOGFILE"
|
echo "$NOW - Beginning Unison with command: unison $UNISONPROFILE" >> "$LOGFILE"
|
||||||
unison "$UNISONPROFILE"
|
unison "$UNISONPROFILE"
|
||||||
else
|
else
|
||||||
if [ "$USEPROFILE" = "true" ]; then
|
if [ "$USEPROFILE" = "true" ]; then
|
||||||
@@ -338,11 +336,11 @@ function mainScript() {
|
|||||||
die "We were missing the Unison Profile. Could not sync."
|
die "We were missing the Unison Profile. Could not sync."
|
||||||
fi
|
fi
|
||||||
# Run unison with a profile
|
# 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"
|
unison "$UNISONPROFILE" "$SOURCEDIRECTORY" "$TARGETDIRECTORY"
|
||||||
else
|
else
|
||||||
# Run Unison without a profile
|
# Run Unison without a profile
|
||||||
echo "$NOW - Beginning Unison Sync" >> "$LOGFILE"
|
echo "$NOW - Beginning Unison with command: unison $SOURCEDIRECTORY $TARGETDIRECTORY" >> "$LOGFILE"
|
||||||
unison "$SOURCEDIRECTORY" "$TARGETDIRECTORY"
|
unison "$SOURCEDIRECTORY" "$TARGETDIRECTORY"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -351,6 +349,8 @@ function mainScript() {
|
|||||||
# Unmount the drive (if mounted)
|
# Unmount the drive (if mounted)
|
||||||
if [ "$NEEDMOUNT" = "true" ] || [ "$NEEDMOUNT" = "TRUE" ]; then
|
if [ "$NEEDMOUNT" = "true" ] || [ "$NEEDMOUNT" = "TRUE" ]; then
|
||||||
unmountDrive "$REMOTEVOLUME"
|
unmountDrive "$REMOTEVOLUME"
|
||||||
|
echo "$NOW - $REMOTEVOLUME Unmounted" >> "$LOGFILE"
|
||||||
|
e_success "$REMOTEVOLUME UnMounted"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Time the script by logging the end time
|
# Time the script by logging the end time
|
||||||
|
|||||||
Reference in New Issue
Block a user