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

Enhance Your Hacked Tivo With This Script

Discussion in 'TiVo Underground' started by rbautch, Jul 21, 2005.

  1. Dec 15, 2005 #981 of 2880
    GaryD9

    GaryD9 New Member

    90
    0
    Mar 1, 2002
    Gaithersburg...
    cygwin? Compile linux stuff on a Win32 machine? Ugh! ;) It should be easier to find a cross compiler from linux (x32 or x64) to linux (mips)

    Actually, I already have something similar: a linux mips cross compiler for compiling binaries to my linux-based Linksys router... I'll have to dig some...

    What I want, in the end, is a simple way to know how long the box has been up. This would be similar to 'uptime', but NOT in human readable form. I can also get it from "cat /proc/uptime" and doing some math - but I'd have to parse the contents of uptime first (uptime contains TWO numbers: number of seconds since booting, and number of IDLE seconds (not exactly, but close) since reboot.

    In C, this is trivial: call a kernel function to get, basically, the same thing that /proc/uptime provides, but in a structure. Then, take the proper element of the structure, do the math (/60/60/24) and return the value.

    I'll try to find time (ha!) tonight to find a cross compiler... Perhaps I should just write the silly thing as a daemon so its not dependent on crond... hmmm

    (For those not reading the zipper thread - I'm trying to rework the reboot portion of rbauth's stuff to conditionally reboot based on: only FORCE a reboot if the system has been up 6 days. Otherwise, attempt a reboot if not recording once a day if the system has been up over 3 days.. )
     
  2. Dec 15, 2005 #982 of 2880
    Greencat

    Greencat New Member

    169
    0
    Jan 21, 2004
    Grand Rapids MI
    Could it be finding the file from another Dtivo on the network and downloading it? When I get home tonight I will try the new script again but I think I have done this many times with no sucess. I used the find command to look for extra rbautch_files.tgz files and never find one.

    Should I try to fix the DNS first? Is there a script for it since 6.2 took the menu option out?

    Thanks for your help
     
  3. Dec 15, 2005 #983 of 2880
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    This bad boy will give you the current "up time" in days:
    Code:
    x=86400; secup=`cat /proc/uptime | cut -d '.' -f0`; daysup=$(($secup / $x)); echo $daysup
    
     
  4. Dec 15, 2005 #984 of 2880
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    You can fix DNS by editing the /etc/resolv.conf file with your routers IP address. I selfishly want to get to the root of the problem in case there is an anomoly in the script, so I'd rather you try to get the script to do it for you instead of doing it manually.
     
  5. Dec 15, 2005 #985 of 2880
    Greencat

    Greencat New Member

    169
    0
    Jan 21, 2004
    Grand Rapids MI
    If the script can not download without the DNS how does it find rbautch_files.tgz? I did a find command on rbautch* and only found the file in /enhancements. Since I deleted this directory each time it must be finding this somewhere on the lan?

    Will it hurt if I rename rbautch_files.tgz on the Dtivo that is working to test if the script is finding it there?

    Is the IP address the router address. For example 192.168.10.1. I didn't think that was a DNS but does it forward the request on to my ISP DNS?

    Thanks for your help
     
  6. Dec 15, 2005 #986 of 2880
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    It's not finding it on your LAN, but if it keeps showing up, I think that it may be creating a "dummy file" that's actually empty. Try FTPing the rbautch_files.tgz arhive to you pc and see if there's anything in there.
    Won't hurt, but I doubt that's what's happening. You can test it by just disconnecting your other tivos.

    On a typical network setup, your router address is your DNS address.
     
  7. Dec 15, 2005 #987 of 2880
    dfriedland

    dfriedland New Member

    36
    0
    Apr 6, 2002
    Hmmmm. I went to edit my file, and it already had my correct router address in it.
     
  8. Dec 15, 2005 #988 of 2880
    GaryD9

    GaryD9 New Member

    90
    0
    Mar 1, 2002
    Gaithersburg...
    That'll work for now. I'll give you a 'complete' script in an hour or two. It won't be completely tested (of course), but it SHOULD work. Once I have a cross compiler going (this weekend?) I'll write a seperate daemon for doing this - removing the reliance on crond, allowing a "window" of reboot times (ie: Tivo can reboot anytime between 08:10 UTC and 10:10 UTC if nothing is recording..), etc.
     
  9. Dec 15, 2005 #989 of 2880
    Greencat

    Greencat New Member

    169
    0
    Jan 21, 2004
    Grand Rapids MI
    Your correct the file is zero bytes. What would you suggest?

    I tried adding the DNS and running the script. This is the results. I wanted to see how far it would get. I have another tivo that I did not change the DNS.


    I did this with the firewall onthe router turned off. Is this using port 80 and do some ISPs block that port?
     
  10. Dec 15, 2005 #990 of 2880
    GaryD9

    GaryD9 New Member

    90
    0
    Mar 1, 2002
    Gaithersburg...
    Okay, I've changed my crontab to remove the reboot warning osd's, and changed the crontab entry for the actual reboot to call this script:

    I've barely tested this, but I don't see why it wouldn't work. At least the timers work. :)

    In the meantime, I'm pulling the S2 cross compiler toolchain (source) right now to see if I can get a cross-compiler working on my amd64 linux server. If so, I'll probably replace this script with (as mentioned earlier) a single executable that does it's own time checking, can handle ranges, etc...
    Code:
    #/bin/sh
    daysup=$((`cat /proc/uptime | cut -d '.' -f0` / 86400));
    # daysup=$((`cat /var/uptime | cut -d '.' -f0` / 86400));
    
    if [ $daysup -gt 5 ]; then
      echo 'SCHEDULED REBOOT IN 20 MINUTES...' | /var/hack/bin/out2osd -c1 -fblack1 -byellow -d3
      sleep 10m
      echo 'SCHEDULED REBOOT IN 10 MINUTES...' | /var/hack/bin/out2osd -c1 -fblack1 -byellow -d3
      sleep 10m
      echo 'SCHEDULED REBOOT IN 10 SECONDS...' | /var/hack/bin/out2osd -c1 -fblack1 -byellow -d3
      reboot
    elif [ $daysup -gt 3 ]; then
      echo 'SCHEDULED REBOOT IN 20 MINUTES (if not recording)...' | /var/hack/bin/out2osd -c1 -fblack1 -byellow -d3
      sleep 10m
      echo 'SCHEDULED REBOOT IN 10 MINUTES (if not recording)...' | /var/hack/bin/out2osd -c1 -fblack1 -byellow -d3
      sleep 10m
      echo 'SCHEDULED REBOOT IN 10 SECONDS (if not recording)...' | /var/hack/bin/out2osd -c1 -fblack1 -byellow -d3
      tivosh /enhancements/safereboot.tcl; echo "`date` SCHEDULED REBOOT" >> /var/spool/cron/cronlogs/CRONLOG-MAIN
    fi
    
     
  11. Dec 15, 2005 #991 of 2880
    ttodd1

    ttodd1 Proud Computer Geek

    1,516
    0
    Nov 5, 2003
    SC
    And on an untypical one it could be your DSL/cable modem.....
     
  12. Dec 15, 2005 #992 of 2880
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    The simplist way is to grab the tools disk download from the Zipper site and extract rbautch_files.tgz from there. I'll adjust the script to check for a successful download differently. Not sure why your download is failing. Is it connected to your network okay? Trying pinging your router from your tivo (using /busybox/ping). How are you setting your IP parameters?
     
  13. Dec 15, 2005 #993 of 2880
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    You've got mad skills. I've got cross-compiler envy.
     
  14. Dec 15, 2005 #994 of 2880
    GaryD9

    GaryD9 New Member

    90
    0
    Mar 1, 2002
    Gaithersburg...
    First attempt, using the scripts/etc on sourceforge was a bomb. No luck. Now trying a script based on the sourceforge stuff, but altered for tivo7.2 kernels. Personally, I don't care what kernel the entire thing is set up for - they are ALL using 2.4.x linux kernels (and I'm not going to be recompiling that anyway.)

    This new 7.2 script is recompiling life, the universe, and everything. So it might be another 42 minutes until it's done. In the meantime, I'm going to bed. I'll ssh into my box when I get to work in (ugh - 7 hours) and see how it's moving along. I'm trying to remember how to ... er... a minute...
     
  15. Dec 15, 2005 #995 of 2880
    GaryD9

    GaryD9 New Member

    90
    0
    Mar 1, 2002
    Gaithersburg...
    I have an xmas gift for you, rbautch...
    GNU wget 1.10.2
    Just compiled that on my amd64 box, and ftp'd it over to my refurb (HDVR2 w/ 6.2)... and it appears to work. Enjoy :)
     
  16. Dec 15, 2005 #996 of 2880
    rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    You are the man. Thanks!
     
  17. Dec 16, 2005 #997 of 2880
    tonydi

    tonydi New Member

    63
    0
    Mar 21, 2003
    San Jose, CA
    It seemed to me like my problems with the Zipper process that I reported over the last couple of days in the other thread are centered on the Enhancements scripts so I'm moving over to this thread.

    Today I used the exact same CD's and almost the exact same procedure to Zipper my third HDVR2. It appears to have gone without incident, no "can't find file/directory" errors, no hang, nothing. The only difference was that this time I used the XP SP2 telnet procedure. Note that I do not have SP2 installed on this box but I wondered if perhaps whatever change SP2 made to telnet might have also come aboard via some other critical update. No idea if it was this change or just fate. :rolleyes:

    One thing that's common to all three Zipper'd units is that crond does not start after a reboot. I've looked at the author files and all of them have this:

    # start crond after waiting 30 seconds
    sleep 30
    /busybox/crond

    Yet a ps does not show it running.

    Any idea what could be causing it not to load?
     
  18. Dec 16, 2005 #998 of 2880
    tonydi

    tonydi New Member

    63
    0
    Mar 21, 2003
    San Jose, CA
    Ooops, forgot the second problem.

    Only one of the author files has the TivoWebPlus lines:

    #############################################
    # starting Tivowebplus
    /enhancements/TWPrun.sh

    The one that has this is today's patient, my third HDVR2. Perhaps the fact that the other installs didn't go according to plan explains the problem.

    However, TWP doesn't load on this box! So like the crond issue, here's another thing that isn't loading from the author file.

    Both busybox and enhancements directories are in the path statement.

    Both tivoftpd and netserver do load so at least part of the author file is executing.

    Suggestions?
     
  19. Dec 16, 2005 #999 of 2880
    Greencat

    Greencat New Member

    169
    0
    Jan 21, 2004
    Grand Rapids MI
    How do I use the the extract? I can ftp it but how do I get it to run? If I use sh tweak.sh it will not run with /enhancements. Do I ftp the extract to another folder and then use tweak.sh?

    I will try the ping when I get home tonight. The IP addresses are static and were setup under 4.0.

    Thanks for all your help. Let me know if you want me to test anything to see why the script is failing.
     
  20. rbautch

    rbautch User

    3,629
    0
    Feb 5, 2004
    Chicago, IL
    Try running the author file from the bash prompt, just like it was a script. Then check to see what's running with ps. If something did not get added to the author file, either add it manually, or uninstall/reinstall the script.
     

Share This Page