#!/bin/sh
set -e

if [ "$(id -u)" -ne 0 ]; then
  echo "$0 runs as root"
  exit 1
fi

LOG_FILE=${LOG_FILE:=/var/log/wpa.log}

if [ ! -f ${LOG_FILE} ]; then
    echo "interface,ssid,id_str,event,epoch" > ${LOG_FILE}
fi

echo "$1,$2,$3,$4,$(date +%s)" >> ${LOG_FILE}
