I want to log my public ip to a file using cron. Something like this:
2021-05-17T01:11:46 99.99.99.99
2021-05-17T01:12:46 99.99.99.99
2021-05-17T01:13:46 99.99.99.99
Here's what I've cobbled together:
* * * * * { date +%FT%T | tr "\n" " "; curl https://ipinfo.io/ip -s ; echo "" ; } >> /home/mario/logs/pubip.log
It works* in at sh prompt but once I put the asterisks in front and put it into crontab -e I get the following error:
/bin/sh: 1: Syntax error: end of file unexpected (expecting "}")
OS: Ubuntu 20.04.2 LTS
*There's gotta be a more elegant way to handle the formatting. What I frankensteind feels pretty awkward.
curl https://api.ipify.org
– Fanatique May 27 '21 at 14:12