Results 1 to 2 of 2

Thread: OpenDNS script

  1. #1

    OpenDNS script

    Hi.

    I have strange situation with OpenDNS update script.
    It is looks like this:
    Code:
    #!/bin/sh
    TEMP=pliktemp
    trap cleanup 1 2 3 6
    cleanup()
    {
       rm $TEMP
       exit 1
    }
    
    update()
    {
            /opt/bin/curl -o $TEMP -u user:password https://updates.opendns.com/nic/update
    
    
            if [ `cat $TEMP | grep -c good` = 1 ]
            then
                    logger OpenDNS updated successfully
            else
                    while [ $ERROR -gt 0 ]; do
                            ERROR=$(($ERROR-1))
                            sleep 10s
                            update
                    done
                    logger OpenDNS update failed
            fi
    }
    
    update
    rm $TEMP
    exit 0
    When I run this script manually it is working fine, in system log I got something like:
    Code:
    Sep 30 16:11:46 admin: OpenDNS updated successfully
    But when I put this script in cron "cron.hourly" directory, after execution in system log i got:
    Code:
    Sep 30 16:01:33 admin: OpenDNS update failed
    What is wrong?

    Please give some help

  2. #2
    Join Date
    Feb 2007
    Location
    Moscow, Russia
    Posts
    3,781
    Generally speaking, the probable difference between manual run of the script and starting of it from cron (or post-boot etc.) is the environment. Usually in such cases there is something wrong with PATH variable.

    I'd suggest:
    1) check what the environment is during the execution of the script
    2) declare PATH explicitly at the beginning of the file

Similar Threads

  1. Update NoIp, DynDNS, dyn.ee, ipactive via script
    By rj.2001 in forum WL-500g/WL-500gx Tutorials
    Replies: 9
    Last Post: 04-01-2011, 15:48
  2. How do I create a post-boot script?
    By ChessMaster in forum WL-500g Q&A
    Replies: 0
    Last Post: 06-09-2008, 06:57
  3. BusyBox cgi Script Fehlerbehandlung
    By WLAN-Fan in forum German Discussion - Deutsch (DE)
    Replies: 0
    Last Post: 03-06-2008, 16:11
  4. Script for asus router
    By and_woox in forum WL-500gP Q&A
    Replies: 1
    Last Post: 12-11-2007, 03:53
  5. Call script from post-boot and not returing?
    By scriptman in forum WL-500gP Q&A
    Replies: 2
    Last Post: 04-12-2006, 03:56

Posting Permissions

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