How to write script to update the ip address

Hi all,
I need a help to write a script write on my Mac OS 10.10.1
I have a dynamic DNS that need to update through a URL for the new  public IP address.
The script to get the current external IP address
curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' 
This is the URL need to update everything 5 minutes with the output of the current public Ip address or it can detect the change if change then do update if no then do nothing,
https://domain.com/update?host=ab&domain=abc.com&password=xx&ip=1.1.1.1
Thanks for the help

Storing passwords in a shell script is an EXTREMELY bad idea. The following will get the current IP address, validate the IP address, test whether the IP address has change by reading the file /var/tmp/stored_ip or create the file if it doesn't exits- DO YOUR COMMAND HERE is the line that I am going to let you figure out.
#!/bin/ksh
new_ip="$(/usr/bin/curl -s https://icanhazip.com/)"
if [ -f /var/tmp/stored_ip ]; then
    if /usr/bin/host $new_ip > /dev/null 2>&1; then
        printf "%s\n" "Valid IP address found"
    else
        printf "%s\n" "Invalid IP address"
        exit 1   
    fi
else
    printf "%s\n" "$new_ip" > /var/tmp/stored_ip
    exit 1
fi
read -r stored_ip < /var/tmp/stored_ip
if [ "$new_ip" = "$stored_ip" ]; then
    printf "%s\n" "IP address has not changed"
else
    DO YOUR COMMAND HERE
fi
printf "%s\n" "$new_ip" > /var/tmp/stored_ip
exit 0

Similar Messages

  • Can someone plz confirm me that how i can change or update the security questions related to my apple id? as i have been never put them since i create my apple id but now due to some security reasons its asking me again and again the answers. i am unable

    can someone plz confirm me that how i can change or update the security questions related to my apple id? as i have been never put them since i create my apple id but now due to some security reasons its asking me again and again the answers. i am unable to go through the process. thanks.

    Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities

  • I have Photoshop CS 5.5 version, but I've just changed my camera and I can't open my raw files. I need for my new camera Photoshop CC and Camera Raw 8.7 version. How can I do to update the old version? Thank you

    I have Photoshop CS 5.5 version, but I've just changed my camera and I can't open my raw files. I need for my new camera Photoshop CC and Camera Raw 8.7 version. How can I do to update the old version? Thank you

    Thank you for your valuable advice. I've solved the problem right now.
    Thanks
    2015-03-16 15:06 GMT+01:00 c.pfaffenbichler <[email protected]>:
        I have Photoshop CS 5.5 version, but I've just changed my camera and
    I can't open my raw files. I need for my new camera Photoshop CC and Camera
    Raw 8.7 version. How can I do to update the old version? Thank you
    created by c.pfaffenbichler
    <https://forums.adobe.com/people/c.pfaffenbichler> in *Photoshop General
    Discussion* - View the full discussion
    <https://forums.adobe.com/message/7302535#7302535>

  • How to write two item in the same line?

    In the smartforms,how to write two item in the same line?
    eg
    1   *************                                    2  *****************
    3  **************                                   4  ******************
    5  ***************
    Anyone got any idea to do this.
    Thanks in advance

    Hi,
    In the smartform the main windows is 20cm.I use the table output my data.Because the output is two item in same line,I define two rows in the table line type.
    Question:
    Should I define the table width 20cm?
    In the main area of table , should I define two folders and each of folder include a line? The second item I had already defined as Append Directly,but the item 1 and item 2 don't in the same line.
    Regards

  • I no longer have access to the email address that is stipulated as my rescue email address and I cannot remember the answers to my security questions. Please advise how I go about changing / updating the answers to the security questions.

    I no longer have access to the email address that is stipulated as my rescue email address and I cannot remember the answers to my security questions. Please advise how I go about changing / updating the answers to the security questions.

    Contact iTunes Support:
    http://support.apple.com/kb/HT5699?viewlocale=en_US
    or by email:
    https://ssl.apple.com/emea/support/itunes/contact.html
    Cheers,
    GB

  • TS2776 How to switch wifi on and the wifi address N/A?

    How to switch wifi on and the wifi address N/A iPhone 4s?

    LabVIEW 2013 has inbuilt Plot Visible selection in Plot Legand in Waveform Graph

  • Any BAPI or FM to use to update the Customer Address with change log?

    Hi, does anyone have used any BAPI or FM that will update the customer address (Central Address management fields) and the change will be logged in the change history of customer master? I have tried several FM that can update the fields but none of the change will show up in the change history of the customer master.
    So far, I have tried the following FM:
    ADDR_MAINTAIN_COMPLETE
    ADDR_UPDATE
    BDC is not acceptable due to high volume of data. However, the change log is also required.
    Please share any advice.
    Thank you,

    Hi Minami,
    for chenge address use FM : BAPI_BUPA_ADDRESS_CHANGE       (SAP BP, BAPI: Change Address)
    otherwise check with below FM ,for address related information
    BAPI_BUPA_ADDRESSES_GET              SAP BP, BAPI: Determine All Addresses
    BAPI_BUPA_ADDRESS_ADD                   SAP BP, BAPI: Add Address
    BAPI_BUPA_ADDRESS_CHANGE                 SAP BP, BAPI: Change Address
    BAPI_BUPA_ADDRESS_GETDETAIL             SAP BP, BAPI: Read Address
    BAPI_BUPA_ADDRESS_GET_NUMBERS    SAP BP, BAPI: Read Address Numbers
    BAPI_BUPA_ADDRESS_REMOVE                    SAP BP, BAPI: Delete Address
    Regards,
    Tutun

  • How can I script Firefox updates using vbScript, PowerShell or C#?

    I would like to script Firefox updates using vbScript, PowerShell or C#, are there any API calls I use to do this? There are several different OS version versions that I support and auto update is not an option. I do updates at a specific time of the month. I would like to write a script that would download and install the update for the currently installed version of Firefox (32 or 64 bit) for the version of the OS (32 or 64bit). I can detect the OS version and the Firefox version. I can download updates but I do not want to hard code anything.

    hello, for some documentation on how the firefox updates work, please refer to https://wiki.mozilla.org/Software_Update (also the links at the bottom of the page!).

  • How to write script to delete contact?

    For some reason, my exchange services repeatedly creates a contact in my address book. I don't know how to stop it. Instead I think I'll just schedule a script to run every 5 minutes to delete this contact.
    How do I write a script that deletes a contact that matches a certain email address and that the first name and last name fields are empty?
    Thanks!!

    Given a choice between deleting a contact every five minutes — which gains little for the resources and effort involved — or ignoring the contact that's getting added, or figuring out what's adding the contact, I'd look to figure out what is adding the contact. 
    What software is being used to manage contacts?  Is there Exchange Server and maybe Outlook in use?  Or are some other local tools to manage contacts?  Any particular contact?  Maybe this discussion might help?
    That written, there are various AppleScript scripts around that work with the Address Book; here's one, and here's another.  (How this works depends on what tools you're using here; Outlook, or the Apple Address Book / Contacts app, etc.)

  • How to write script calling with parameter [CS6-js (Mac)]

    I'm doing script for produsing some sound:
    var mString = "tell application \"Play Sound\"\rplay \"Mac:Users:a.ivanov:Sounds:" + "copied.wav" + "\"\rend tell"
    app.doScript(mStrtest, ScriptLanguage.applescriptLanguage);
    This work well.
    Now, i'd like to call this script from other script with any desired wav-file (not only "copied.wav" )). How to write down correctly calling other script with param.
    Thanks

    Hi,
    var myParameters = ["Mac:Users:a.ivanov:Sounds:", "copied.wav"];
    var myAppleScript = "tell application \"Play Sound\" to play  ((item 1 of arguments) & item 2 of arguments)";
    app.doScript(myAppleScript, ScriptLanguage.applescriptLanguage, myParameters);
    doScript also excepts file, so if wanted save the line myAppleScript as *.jsx and insert the Filereference in the doScript
    P.S. Assume MacOsx prior 10.5 may not include afplay

  • How to write select statement before the loop and how to use read statemnt

    Hi,
    Recently our system has changed from 4.6 to ECC6.
    As its migrated its showing lots of errors like in between loop and endloop there should be no select statemnt........
    Can any one please tell how to write that coding in ECC6 , how can i change the code......
    In between loop and endloop i am having lots of select statemnts.....ple tell thye coding how can i select before the loop starts and
    how to read that internal table in loop.

    Hi Deepthi,
    You can do as per below:
    1) Select the required entries from the tables you need (VBAK, VBAP, KNA1, etc)
    SELECT VBELN ERDAT KUNNR
        into table it_vbak
        from VBAK
    where VBELN = S_VBELN. "Selection criteria
    If sy-subrc = 0.
    SELECT VBELN POSNR MATNR
        into table it_vbap
        from VBAP
    for all entries in it_vbak
    where VBELN = it_vbak-vbeln
    SELECT KUNNR NAME1
        into table it_vbak
        from VBAK
    where VBELN = it_vbak-vbeln.
    endif.
    2) Loop at the entries, and read internal table it-kna1 for customer info.
    Loop at it_vbak into wa_vbak.
    read table it_kna1 into wa_kna1 with key kunnr = wa_vbak-kunnr.
    if sy-subrc = 0.
    endif.
    loop at it_vbap into wa_vbap where vbeln = wa_vbak-vbeln.
    endloop.
    endloop.
    This is the basic idea and short example of how to extract entries and read internal table.
    Hope this helps.
    Regards,
    Patrick

  • How to write and what is the G/L Distribution Report (AP)?

    Hi all,
    I am anticipating  to write some abap reports..Here is one of them..Anyone can help  me with writing a Report , how to write 'G/L Distribution Report (AP) -
    But since I am new to Abap , if you wish to reply, please use a little more detail and simple explanation, step by step so I can understand what is the idea(The Business use, and business idea of doing such report?), how it can be acheived...what kind of report should be used , techniques, tables etc..?.:)
    Appreciate your help!
    Regards,
    Boby

    Hi   ,
    i am get your  exact   report requirements  , nay   , i will give you the   brief expalin.
    AP -> Accoutns  Payable   . so it deals with  in Finnance to  Vendor  .   it means   you are   maintain the  transcations  of the payment s to the vendor .  so thae  table's are .
    vendor master tables  : 
    LFA1 -> Vendor Master (General Section),
    ADRC -> Addresses (Business Address Services)
    LFB1-> Vendor Master (Company Code) ....etc .
    for finance   data  
    BKPF -> Accounting Document Header
    BSEG->Accounting Document Segment
    BSIS->Accounting: Secondary Index for G/L Accounts
    PAYR->Payment Medium File
    WITH_ITEM->Witholding tax info per W/tax type and FI line item ,
    REGUP-> Processed items from payment program ,
    REGUH-> Settlement data from payment program  ,....etc
    with  abouve  given  table you can  do the report  for  vendor   .
    Start  selecting data from the bseg   , because  it will have  all the  data ...... then if  it is  payement    , then  go to the  regup   for  processed  item  ..... it means  payment happpend data   .........  then go to reguh   for  the   payment method  (check, draft ,etc)  then to the payr for check data.etc  .... if you want  vedor   address  go to   lfa1 there  ADRNR  is there primary key to adrc table  for   detail addresss..
    if it  is use full  , reward  points ...........
    Girish

  • How to write program to list the system directory(content of pc)

    how to write a program that will display all the folder n directory of the pc like:
    +My Computer
    +c:
    +d:                                                                                                                                                                                                                                       

    Copy this line and save it in a file named "dirlist.bat":
    for %%* in (%1) do dir /b %2 %1To use it, change to the directory it's in and at the command prompt type
    dirlist directory [/s] directory is the name of the directory that you want listed.
    /s is optional and will list the contents of all subdirectories also.
    (You didn't say it had to be Java - use the right tool for the job)

  • Can you plz tell m how to write Design Strategy in the scenario IDoc-- File

    Hi,
    can any body plz tell me how to write Design strategy, Preprocessing logic and post processing logic in the scenario IDoc-->File.
        My idoc is:
                Message Type: ZMMIPORDCHG
                Basic Type  : ORDERS05.
    lookup's are available.

    Hi,
    take a look at this document for an IDOC to IDOC Scenario,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cdded790-0201-0010-6db8-beb9bb2b2660
    Use it as a template to design one side of the Interface and also take a look at this blog,
    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
    Regards,
    Bhavesh

  • When I update the email address in the Address book the old email address remains an option when I send email to the contact. How do I delete all th old email addressees

    When I update an email address in my address book the old email addresses always remain an option when I sen an email to the contact. How do I delete the oll email addresses from the system?

    Ah, since you posted in the iMac forum I assumed....
    Here's the link to the iPhone forum, those guys will know the answer.
    https://discussions.apple.com/community/iphone/using_iphone

Maybe you are looking for