[PLUG] Adding timestamp to log file entry

Rich Shepard rshepard at appl-ecosys.com
Fri Sep 26 18:13:49 UTC 2014


On Thu, 25 Sep 2014, Robert Citek wrote:

> Assuming that is in a bash script, you can do something like this:
>    echo $(date +%FT%T%:z) ${NEWIP} >> "/home/rshepard/getiplog"

Robert,

   I left out the first 'T' because I did not see 'FT' on the man page; the
time string is not separated from the date string. Just added the 'T' to the
format.

   What's interesting is that I now see how frequently Frontier changes my IP
address. Yes, it's unreasonable to change it so frequently, but ... that's
just the way it is with them. Here's the log since I changed the script
yesterday afternoon:

50.38.103.143
2014-09-25 19:30:08 50.38.109.240
2014-09-26 00:30:07 50.38.84.71
2014-09-26 01:30:02 50.38.71.234
2014-09-26 03:30:02 50.38.79.177
2014-09-26 04:30:06 50.38.97.179
2014-09-26 05:30:03 50.38.126.250

The top IP address was current when I modified the cron script.

Thanks for the lesson,

Rich



More information about the PLUG mailing list