#!/bin/sh PATH=/usr/local/bin:/usr/local/sbin:/usr/local/etc:/bin:/sbin:/usr/bin:/usr/sbin:$PATH if [ $# -eq 2 ]; then ALLOWED_IP=$1 PORT=$2 else ALLOWED_IP=44.130.60.100 PORT=7777 fi export LOGNAME="db0blo" process_input() { while true do read -r LINE || exit 1 if [ "$LINE" == "" ]; then continue fi command=$(echo "$LINE" | awk '{print $1}') if [ "$command" != "rubrik" ] then continue fi echo "$LINE" | pagerrsh done } while true do nc -q1 -u -l $ALLOWED_IP -p $PORT </dev/null 2>/dev/null | process_input done