#!/bin/bash # +----+----+----+----+ # | | | | | # Author: Mark David Scott Cunningham | M | D | S | C | # +----+----+----+----+ # Created: 2016-03-27 # Updated: 2016-04-04 # # Purpose: Lookup the current R1Soft backup manager, and the IP being used for backups. # # Lookup backup manager in the logs logfile="/usr/sbin/r1soft/log/cdp.log" r1host=$( tac $logfile 2>/dev/null | awk -F/ '/server.allow/ {print $NF}' | head -1 | tr -d \' ); # Lookup private IP used for backups r1ip=$( ip -4 -o a | awk '/10\.[1-4][0-2]\./ {print $4}' | cut -d/ -f1 | tail -1 ); # Adjust for hostnames that lack the domain if [[ $r1host =~ liquidweb.com ]]; then r1url=$r1host; else r1url=${r1host}.liquidweb.com; fi; # Print results if [[ -e $logfile ]]; then echo -e "\nR1Soft :: Host :: https://$r1url\nR1Soft :: IPv4 :: $r1ip\n" else echo -e "\n Could not find: $logfile\n R1Soft either not installed or not logging.\n" fi