#!/bin/bash

log_file="${1}/net_info.log"

print_net_info() {
    echo "$(date) - Network Info" >> "${log_file}"
    echo "---------------------" >> "${log_file}"
    echo "ip -br a: " >> "${log_file}"
    echo "$(ip -br a)" >> "${log_file}"
    echo "config.json: " >> "${log_file}"
    jq . /etc/pear/pear_monitor/config.json >> "${log_file}"
    echo "---------------------" >> "${log_file}"
    echo "" >> "${log_file}"
}

while true; do
    print_net_info
    sleep 300
done

exit 0
