#!/bin/bash # A simple script that verifies the ip address # I run it every hour via cron # 0 * * * * /[path]/ipaddress.sh # Path and name of a "master" file that contains the value to check for # Create this file namually, once, using the command "hostname -I >/[path]/ipaddress.master" checkFile="/tmp/ipaddress.master" if [ -f "$checkFile" ]; then checkString=$(/bin/hostname -I) #echo checkString: $checkString countCheck=$(/bin/grep -ixc "$checkString" "$checkFile") #echo countCheck: $countCheck if [ $countCheck -eq 0 ]; then #Schedule a reboot in 5 minutes to reaquire the ip address /sbin/shutdown -r 5 fi else echo Unable to find the checkFile: [$checkFile] fi #EoF