1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problems with Scheduler/Cron

Discussion in 'Tomato Firmware' started by greenythebeast, Sep 28, 2009.

  1. greenythebeast

    greenythebeast LI Guru Member

    Alright, so I installed curl to my mounted USB drive using optware packages. When I telnet into the router I can use curl successfully. I have a script I use to automatically login to my internet service every morning. It goes as follows:

    curl https://resnet.netsec.umn.edu/2007/?original=http://www.cnn.com/ -F username=*** -F password=*** -c /opt/script/resnet-cookie -L -o /dev/null &> /dev/null
    sleep 7
    curl https://resnet.netsec.umn.edu/2007/ -b /opt/script/resnet-cookie -L -o /dev/null &> /dev/null

    When I run these commands using telnet, they work fine. I have tried setting up the Scheduler (Administration -> Scheduler) to run these commands every day at 6am. I put the exact commands shown above into the Command textbox and check all days and select 0600. But when trying to access the internet the next morning, my usual login page comes up. Does anyone know why my commands work through telnet but when I have them set up in the Scheduler they do not work? Thanks for your help.
     
  2. rhester72

    rhester72 Network Guru Member

    Specify the full path to your curl binary in the script.

    Rodney
     
  3. greenythebeast

    greenythebeast LI Guru Member

    How would I go about finding the full path? I know it must be somewhere on /opt since it's installed to the USB drive. But I'm not sure how to find it from there. Thanks for the help.
     
  4. rhester72

    rhester72 Network Guru Member

    find /opt -name curl

    Rodney
     
  5. greenythebeast

    greenythebeast LI Guru Member

    It found two instances of curl.

    /opt/bin/curl
    /opt/share/curl

    I assume I should use /opt/bin/curl?

    Edit: It seems /opt/share/curl is protected, so /opt/bin/curl it is.

    So my command looks like this:

    /opt/bin/curl https://resnet.netsec.umn.edu/2007/?...//www.cnn.com/ -F username=*** -F password=*** -c /opt/script/resnet-cookie -L -o /dev/null &> /dev/null
    sleep 7
    /opt/bin/curl https://resnet.netsec.umn.edu/2007/ -b /opt/script/resnet-cookie -L -o /dev/null &> /dev/null
     
  6. greenythebeast

    greenythebeast LI Guru Member

    Even with the new script, I got the login page this morning. Is there anyway to check if it giving an error?
     
  7. gawd0wns

    gawd0wns LI Guru Member

    Are all of the commands being run?

    Separate each command with a "; " at the end, like this:

    service vpnserver1 stop; sleep 5; cd /; wget http://theinternet/allofit.doc

    or like this:

    service vpnserver1 stop;
    sleep 5;
    cd /;
    wget http://theinternet/allofit.doc

    Don't put "; " on the last command...
     
  8. greenythebeast

    greenythebeast LI Guru Member

  9. greenythebeast

    greenythebeast LI Guru Member

    If I enabled logging would it show me if any errors were occurring as the Scheduler ran?
     
  10. teddy_bear

    teddy_bear Network Guru Member

    Are you using the USB mod?
    If so, you can try adding
    Code:
    . /etc/profile
    line (it starts from the dot) on the top of your script in the scheduled command box.
     
  11. greenythebeast

    greenythebeast LI Guru Member

  12. greenythebeast

    greenythebeast LI Guru Member

    It seems to have worked. I'll report back if I have anymore problems. Thanks!
     
  13. kanstin

    kanstin Addicted to LI Member

    greeny, did you intend for your username and password to be visible to the world?
     
  14. greenythebeast

    greenythebeast LI Guru Member

    Nope, just changed my password. Thanks for the catch kanstin.
     

Share This Page