#!/bin/bash

ACCOUNTING=/var/log/one/accounting.log

case "$1" in
    "on"|"off")
        mode=$1
        shift
        ;;
     *)
        echo "$0 error: wrong mode." >&2
        exit 1
        ;;
esac

if [ "$1" = "" ]
then
    echo "$0 error: ID missing." >&2
fi

id=$1
shift

echo "$id $(date +%s) $mode" >> $ACCOUNTING