#!/bin/bash

# Change NETFLOW_SERVER TO YOUR NETFLOW WEB SERVER ADDRESS
# E.g. https://netflow.our_company.com/
# Don't put slash at the end of the line!!!
NETFLOW_SERVER='http://localhost'


# In default, prefix is netflow for accessing our netflow 
# monitoring software. If you manually install it to 
# another directory, reflect changes ...
# E.g. /netflow/customers
NETFLOW_BASE='/netflow'


#Set path to wget tool. wget is necessary for http refreshing.
WGET="/usr/bin/wget"



if [ ! -x "$WGET" ]; then
  exit 1
fi

if [ "$1" == "refresh" ]; then
  while (true) do
    $WGET -p -O "/dev/null" "$NETFLOW_SERVER$NETFLOW_BASE/src/data/utilimg.php?refresh=1"
    sleep 5
  done
else
  if [ "$1" == "daemon" ]; then
      sleep 1
      $0 refresh &> /dev/null  &
    else
      $0 daemon &> /dev/null &
  fi
fi
exit 0
