Find the answer to your Linux question:
Results 1 to 5 of 5
Hi folks, Ubuntu-6.06.1-LAMP-server-amd64 I have a script.php which is used to update the IP address of my domain on registrar's website. I keep it on /etc/. The IP address of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,787

    Dynamic IP and cron job


    Hi folks,

    Ubuntu-6.06.1-LAMP-server-amd64

    I have a script.php which is used to update the IP address of my domain on registrar's website. I keep it on /etc/. The IP address of the server only changes on connection. Please advise how to create a "cron job" which will run the script after booting to update the IP address.

    Is /etc/ the right directory for holding the script?

    TIA

    B.R.
    satimis

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,133
    The script should probably go into one of the 'bin' folder if it is an executable, unless it is a service/daemon in which case it would go into /etc/rc.d/init.d/ or /etc/init.d/ and then added to the services using the chkconfig command.

    To add a cron command log into a terminal as root and use crontab -
    Code:
    su -
    crontab -e
    You then add the job like this
    Code:
    * * * * * [command]
    Where the asterisks stand for , minute,hour,day-of-month,month,day-of-week - To run it every hour at half past -
    Code:
    30 * * * * /path/to/your/script.sh
    Check out this wikipedia page

  3. #3
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,787
    Hi bigtomrodney,

    Tks for your advice and URL.

    The script.php was download from the website where I registered the domain. There is a short instruction on the file download instructing running the script.php on cron.

    I tried to setup cron with webmin but can't figure out how to set it to run after booting up. Because the IP address of the server only changes on connection. I need to update the IP address on the registrar's website simultaneously.

    Tks.

    B.R.
    satimis

  4. #4
    Just Joined!
    Join Date
    Mar 2006
    Posts
    10
    I am a noob so beware of my advice
    IMO your script should go to your distro's rc.local equivalent because it only need to be run on start up.
    Alternatively check out http://ddclient.sourceforge.net/
    It should be configured as a service with init script and run at startup.

    I would recomment method 2 if your registar supports it.

  5. #5
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,787
    Hi yuri_d,

    Tks for your advice.

    Alternatively check out http://ddclient.sourceforge.net/
    It should be configured as a service with init script and run at startup.

    I would recomment method 2 if your registar supports it.
    I have ddclient running on this server which is for test purpose. I also have "satimis.homelinux.com" registered with dyndns.com. But I can't get it to work, even unable to ping "satimis.homelinux.com" always pointing at "219.79.144.30", the IP in its Database/DNS asigned to me on registration then hanging.

    $ sudo cat /etc/ddclient.conf
    Code:
    Password:
    # Configuration file for ddclient generated by debconf
    #
    # /etc/ddclient.conf
    
    daemon=600
    pid=/var/run/ddclient.pid
    use=web, web=checkip.dyndns.org/, web-skip='IP Address'
    login=satimis
    password=xxxxx
    protocol=dyndns2
    server=members.dyndns.org
    wildcard=YES
    #use=if, if=eth0
    #satimis.homelinux.com
    example.dyndns.org
    custom=yes, example.com
    I spent a week unable to find a solution. Any advice? TIA

    B.R.
    satimis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •