Skip to content

Commit

Permalink
Update get-last-status.sh
Browse files Browse the repository at this point in the history
added section for XigmaNAS users to allow changing of LOGBASE variable if required
  • Loading branch information
tschettervictor authored and aaronhurt committed Aug 23, 2024
1 parent 8214f67 commit 6e49f8d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions get-last-status.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#!/bin/bash

# Set log directory
LOG_DIRECTORY="/var/log/zfs-replicate"
# Set log directory (defaults to /var/log/zfs-replicate)
## for XigmaNAS users, uncomment the next 3 lines
## called SCRIPT SCRIPTPATH and LOGBASE
## and comment out the last line to make sure the
## log files stay in the script directory
#SCRIPT=$(readlink -f "$0")
#SCRIPTPATH=$(dirname "${SCRIPT}")
#LOGBASE="${SCRIPTPATH}/logs"
LOGBASE="/var/log/zfs-replicate"

# Check for existing logs
if ! [ -e ${LOG_DIRECTORY} ]; then
if ! [ -e ${LOGBASE} ]; then
echo "Log directory does not exist, can't check status."
exit 0
fi

# Retrieve latest log status
RECENT_LOG_FILE=$(ls ${LOG_DIRECTORY} | grep autorep- | tail -n 1)
STATUS=$(tail -n 1 ${LOG_DIRECTORY}/${RECENT_LOG_FILE})
RECENT_LOG_FILE=$(ls ${LOGBASE} | grep autorep- | tail -n 1)
STATUS=$(tail -n 1 ${LOGBASE}/${RECENT_LOG_FILE})

echo "Last Replication Status"
echo "----------"
Expand Down

0 comments on commit 6e49f8d

Please sign in to comment.