#!/bin/sh ############################################################################################ # The first part of the script declares types of the colors that will be used for the output ############################################################################################ C_GREEN='\033[0;32m' C_RED='\033[0;31m' C_RESET='\033[0m' out_color (){ if [ "$1" != "1" ]; then echo -e $C_GREEN $2 $C_RESET else echo -e $C_RED $2 $C_RESET fi } /scripts/ipusage | grep -vi http | grep -vi '10.0.' | grep -vi '192.168.' > /usr/local/src/ipusage ############################################################################################ # In this part we verify if server has free IPs ############################################################################################ if [ "$(cat /usr/local/src/ipusage)" == "" ]; then echo 'NO free IPs on this machine' > /usr/local/src/ipusage else touch `hostname | awk -F "." '{print $1}'`; date > `hostname | awk -F "." '{print $1}'`; cat /usr/local/src/ipusage >> `hostname | awk -F "." '{print $1}'`; mv `hostname | awk -F "." '{print $1}'` /usr/local/apache/htdocs fi