diff options
| author | F3RR3T <github@st33v.com> | 2014-08-17 17:05:08 +1000 |
|---|---|---|
| committer | F3RR3T <github@st33v.com> | 2014-08-17 17:05:08 +1000 |
| commit | 1ed1f885f7dce63b62289260ad4fd48679c60e98 (patch) | |
| tree | ea94978db1afa6c6a3043e5628df77624c1d48dc /monitor.sh | |
| parent | 34f95efb5be13b341219ca9bba4ebaed26dae205 (diff) | |
First cut at monitor script. Gets extrnal IP address and writes it to data file with datestamp.
This is run from cron.
Diffstat (limited to 'monitor.sh')
| -rwxr-xr-x | monitor.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/monitor.sh b/monitor.sh new file mode 100755 index 0000000..e902c86 --- /dev/null +++ b/monitor.sh @@ -0,0 +1,23 @@ +#! /bin/sh - + +# SJP 16 August 2014 +# Monitor my external IP address + +# set up logfile + +cd ~/mail/monitor + +if (test -e data/tmp.*) then + datafile=$(ls data/tmp.*) +else + datafile=`mktemp --tmpdir=data` +fi + +echo "datafile = $datafile" + +ip=$(curl ifconfig.me/ip) +dt=$(\date +%Y-%m-%dT%T%:z) + +echo -e "$dt\t$ip" >> $datafile + + |
