`hostname -I` returns all values on one line.

This commit is contained in:
Phil! Gold 2016-10-17 10:04:03 -04:00
parent 24ffbb8c29
commit 5355c24b49
1 changed files with 6 additions and 4 deletions

View File

@ -16,9 +16,11 @@ track their current reputation score.
=head1 CONFIGURATION
By default, the script will use the first IP address returned by C<hostname -I>.
If that's not the right address to use, set the C<ip_address> environment
variable to the appropriate value.
By default, the script will use the first IP address returned by
C<hostname -I>. If that's not the right address to use, set the
C<ip_address> environment variable to the appropriate value. (Note that
if a host has multiple IP addresses, there's no guaranteed ordering for
C<hostname -I>, so you should set the address explicitly in that case.)
[senderbase]
env.ip_address 8.8.8.8
@ -40,7 +42,7 @@ This plugin is made available under a CC0 waiver:
=cut
real_ip_address=${ip_address:-$(hostname -I | head -1)}
real_ip_address=${ip_address:-$(hostname -I | awk '{print $1}')}
ip_reversed=$(echo $real_ip_address | sed -re 's/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/\4.\3.\2.\1/')
query_host=${ip_reversed}.rf.senderbase.org