Title: rsync-monitor.sh.2016.09.30
Created: 2018-04-29 22:27:08 +0000
#!/bin/bash
# File: rsync-menu.sh
# trap for control-c
trap 'exit 2' 2
# the directory this shell script is located in
SCRIPT_HOME="/Volumes/Master-D/shell_scripts/rsync_menu"
CURRENT_LOG_FILE="$SCRIPT_HOME/logs/current_log.txt"
#Read the first line of the current_log.txt file to get the file name
RSYNC_VERBOSE_FILE=`head -n1 "$CURRENT_LOG_FILE"`
clear
while [ "$RSYNC_VERBOSE_FILE" != "-" ]
do
clear
echo "RSYNC MONITOR SCRIPT"
echo "Displaying lines from rsync log: $RSYNC_VERBOSE_FILE :: As of `date`"
echo
if [ "$RSYNC_VERBOSE_FILE" != " " ]; then
tail -n 5 "$RSYNC_VERBOSE_FILE"
echo
fi
sleep 3
#Read the first line of the current_log.txt file to get the file name
RSYNC_VERBOSE_FILE=`head -n1 "$CURRENT_LOG_FILE"`
done
echo
echo "Rsync has finished, exiting."
echo
exit 0