#!/bin/sh # # Returns XMLRPC caller IP (tcosmonitor IP) # STANDALONE=/var/lib/tcos/standalone-server pidssl="$(pidof stunnel4 | sed '/^$/d')" # SSL enabled if [ -f $STANDALONE/log/stunnel.log -a "$pidssl" != "" -a "$1" = "1" ]; then grep "tcosxmlrpc accepted connection" $STANDALONE/log/stunnel.log |tail -1 | awk '{print $NF}'| awk -F ":" '{print $1}' exit 0 fi # SSL disabled (not stunnel4 logs) read XMLRPC abyss log if [ -f $STANDALONE/log/access.log ]; then tail -1 $STANDALONE/log/access.log | awk '{print $1}' exit 0 fi