From a554566fc3710cdffa9a829062f33454605a7589 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 11 Mar 2012 19:57:40 -0400 Subject: [PATCH] getting the ip job more up to date. still needs newer automation url. --- .../cron/tell_zooty_our_ip.crontab | 9 ++++++ scripts/security/tell_zooty_our_ip.sh | 30 ++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 database/configuration/cron/tell_zooty_our_ip.crontab diff --git a/database/configuration/cron/tell_zooty_our_ip.crontab b/database/configuration/cron/tell_zooty_our_ip.crontab new file mode 100644 index 00000000..cbdf22dc --- /dev/null +++ b/database/configuration/cron/tell_zooty_our_ip.crontab @@ -0,0 +1,9 @@ + +SHELL=/bin/bash + +# m h dom mon dow command + +# special for equanimity; get zooty informed of our IP so we can make +# the back-connection and get home. +14,28,42,56 * * * * (bash /home/fred/feisty_meow/scripts/security/tell_zooty_our_ip.sh) 2>&1 >>/tmp/zooty_tell_report.txt + diff --git a/scripts/security/tell_zooty_our_ip.sh b/scripts/security/tell_zooty_our_ip.sh index c616a1ab..9c5b02a1 100644 --- a/scripts/security/tell_zooty_our_ip.sh +++ b/scripts/security/tell_zooty_our_ip.sh @@ -19,30 +19,24 @@ fi ip_file="$(mktemp ${tempdir}/$(hostname | sed -e "s/\..*$//")_ip.XXXXXX)_${USER}" -# iterate forever, since we want to keep running this. -while true; do +# get live ip address +pushd $tempdir +wget http://automation.whatismyip.com/n09230945.asp -O "$ip_file" - # get live ip address - pushd $tempdir - wget http://automation.whatismyip.com/n09230945.asp -O "$ip_file" +chmod 644 "$ip_file" +my_ip=$(head "$ip_file") - chmod 644 "$ip_file" - my_ip=$(head "$ip_file") +echo "my ip is [$my_ip]" - echo "my ip is [$my_ip]" - - # send the file over to the server. - # note that the local_user here is expected to have a certificate that - # gets us access to the server. this needs to be on the local machine - # for sftp to run without a login prompt. - sudo -u $local_user sftp $username@$server <