Results 1 to 6 of 6

Thread: Replace file after 2+ reboots?

  1. #1
    Join Date
    Mar 2002
    Posts
    321

    Replace file after 2+ reboots?

    I am looking for a way to replace a file after a certain number of reboots.

    More specifically, say I corrupt a file like dssapp or tivoapp; I want a way to automatically copy back the old file. Something to prevent me from having to pull the hard drive.

    Anyone have any ideas?

  2. #2
    Join Date
    Jan 2002
    Posts
    5,601
    Automatically isn't a very good idea. It would require you to insert the 'watchdog' after modifying anything, then remove it if everything is working OK. Forget to insert it and a error will force you to pull the drive; forget to remove it and a power failure a few weeks from now will undo the changes. OK, some really clever coding will ensure the undo occurs only if the two reboots occur within 2 minutes.

    I prefer a second approach: Use the crypto command to set up a known password. Duplicate a good root file system to the alternate partition, modifying fstab so the proper partition gets mounted in each case. If you encounter a problem, hitting a key on your serial terminal will bring up the prom menu, and you can boot to the alternate (unmodified) partition. The chief disadvantage is you must have a serial connection.

    Some of the elders (AlphaWolf, alldeadhomiez) have mentioned inserting a delay in rc.sysinit. If you hit a key in that time it will boot to a minimal system. You must have a serial connection or load network drivers VERY early.

    PlainBill
    There's a difference between needing help, and just being plain ole' lazy.

    "You cannot teach a man anything. You can only help him find it for himself." Galileo Galilei (1564-1642)

    HR20-700 with 2 TB, HR22-100, HR22-100, HR22-100, HR23-100 all running 0x5cd and networked.

  3. #3
    Join Date
    May 2005
    Posts
    913
    Quote Originally Posted by PlainBill
    Some of the elders (AlphaWolf, alldeadhomiez) have mentioned inserting a delay in rc.sysinit. If you hit a key in that time it will boot to a minimal system. You must have a serial connection or load network drivers VERY early
    FWIW, the delay that is mentioned is prior to loading author (to let the tivo boot up faster), it doesn't delay loading tivo s/w

    Loading networking early is probably your best bet... you CAN check for most reboot-loops by creating a file on boot that only gets deleted after author finishes, but it can be self-defeating (a brown-out situation could leave your tivo s/w not running). During a reboot loop, if you connect to your box early on, you can type "skill -9 /etc/rc.d/rc.sysinit" at bash to stop the tivo s/w from coming up fully, that should allow you to fix most things.

  4. #4
    Join Date
    Mar 2002
    Posts
    321
    How about I do this:

    1. At the beginning of rc.sysinit check for the existence of a file name "fixme.log"

    2. If fixme.log exists, then replace some file (that I was messing with) with a backup

    3. At the end of rc.sysinit.author delete "fixme.log"

    So if I do the above in the mentioned order it should allow me to replace some file with a backup copy. Possibly I could expand it to read "fixme.log" and read the filename that needs to be replaced with a backup?

    Sound like a plan?

    The main file I am messing with, dssapp, shouldn't cause the system to die, but just in case...

  5. #5
    Join Date
    May 2005
    Posts
    913
    That's certainly doable, but keep in mind, there ARE times that a tivo reboots without completing rc.sysinit.author... anytime that happens (and rc.sysinit has been run), your file would be replaced.

  6. #6
    Join Date
    Jul 2003
    Posts
    669
    Quote Originally Posted by onyx00
    How about I do this:

    1. At the beginning of rc.sysinit check for the existence of a file name "fixme.log"

    2. If fixme.log exists, then replace some file (that I was messing with) with a backup

    3. At the end of rc.sysinit.author delete "fixme.log"

    So if I do the above in the mentioned order it should allow me to replace some file with a backup copy. Possibly I could expand it to read "fixme.log" and read the filename that needs to be replaced with a backup?

    Sound like a plan?

    The main file I am messing with, dssapp, shouldn't cause the system to die, but just in case...
    You might take a look at this thread StopLoop....
    Four Hacked HDVR2's,
    One Still slightly confused Hacker,
    4 dogs, 8 cats, and 1 wife that is happy as long as I don't screw up her TiVo ...... Oh yeah two grandchildren that are the light of my life!

Posting Permissions

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