Skip to content

Commit 376bfbd

Browse files
committed
Add wd-myip
1 parent ad3f386 commit 376bfbd

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.wd_bash_aliases

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,22 @@ function wd-query()
463463
alias wd-q='wd-query'
464464
alias wdq='wd-query'
465465

466+
function wd-myip()
467+
{
468+
local my_ip
469+
local rc
470+
471+
curl -s ifconfig.me > /tmp/myip.txt
472+
rc=$?
473+
if [[ ${rc} -ne 0 ]]; then
474+
echo "ERROR: 'curl ifconfig.me' => ${rc}"
475+
return 1
476+
fi
477+
my_ip=$(< /tmp/myip.txt)
478+
echo "My public IP = ${my_ip}"
479+
return 0
480+
}
481+
466482
### Reloads these functions and aliases into the users running bash (must be an alias)
467483
alias wd-rc='source ~/wsprdaemon/.wd_bash_aliases'
468484
alias wdrc='wd-rc'
@@ -480,7 +496,7 @@ wd-upload-wd wd-uw wdlw Watch the 'upload to wsprdaemon' log
480496
wd-errors wd-e wdle Each 10 seconds, search all the log files and print newly logged 'ERROR' lines
481497
wd-overloads wd-ov wdov Prints all overload events recorded in the wav and ADC log files
482498
wd-query wd-q wdq Query the wsprdaemon database for spots
483-
"
499+
wd-myip *** Prints the public IP address of this server"
484500
}
485501
alias wd-='wd-help'
486502
alias wd-h='wd-help'

0 commit comments

Comments
 (0)