SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Customizations
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-05-2006, 01:21 AM
Enormous's Avatar
Enormous Enormous is offline
Sage Aficionado
 
Join Date: Mar 2004
Location: D.C. Area
Posts: 398
Script for backing up before updating Sage installation

Here is a little script I put together that will backup your SageTV directories, and also backup your irremote.ini. Makes installation of another version of SageTV a little less tedious. After the installation is done, I usually copy the backed-up version of the irremote back into the windows directory.

Code:
@echo off
SET SageTVDir=C:\Program Files\SageTV
SET backupDir=C:\Sage Backup\SageTV backups
SET windowsDir=C:\WINDOWS

FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%mm%-%dd%-%yyyy%
SET folderName=Sage backup %date%

MKDIR "%backupDir%\%folderName%"

ECHO Backing up SageTV Common directory
MKDIR "%backupDir%\%folderName%\Common"
XCOPY "%SageTVDir%\Common" "%backupDir%\%folderName%\Common" /s

ECHO Backing up SageTV directory
MKDIR "%backupDir%\%folderName%\SageTV"
XCOPY "%SageTVDir%\SageTV" "%backupDir%\%folderName%\SageTV" /s

ECHO Backing up Irremote.ini
COPY "%windowsDir%\Irremote.ini" "%backupDir%\%folderName%"
MOVE "%backupDir%\%folderName%\Irremote.ini" "%backupDir%\%folderName%\Irremote%date%.ini"

ECHO Backup for %date% complete
Just copy the above code into a .bat file, and try it out!

Please feel free to post improvements, as I'm sure there are lots that could be made!
__________________
-Eric
Client: STX-HD100 Extender, Connected to 47" Visio 1080p LCD via HDMI, Running SageMC
Client: Media MVP Running SageMC
Server: Antec SLK3800B, AMD Athlon 64 X2 4200+, Biostar TForce 550, GeForce 7300LE, 1GB DDR2 800, 2 x HVR-1600, PVR-150MCE, 1.4TB HD Space, XP Pro, Java6, Latest SageTV Version
Reply With Quote
  #2  
Old 03-09-2006, 05:37 PM
geogecko geogecko is offline
Sage Icon
 
Join Date: Dec 2004
Location: North Oklahoma
Posts: 2,273
What is the irremote.ini file used for? Is it all of your remote's learned commands in Sage?
__________________
-Jason
Reply With Quote
  #3  
Old 03-09-2006, 06:01 PM
Humanzee's Avatar
Humanzee Humanzee is offline
Sage Fanatic
 
Join Date: Sep 2004
Location: North Idaho
Posts: 752
Quote:
Originally Posted by geogecko
What is the irremote.ini file used for? Is it all of your remote's learned commands in Sage?
Find a post from Opus4, he has a link in his signature about remotes. The irremote.ini is a windows file that stores remote codes for specific applications. I think it is seperate from what sage does because you can set up commands for Windows Media Player etc.

I have mine tailored so that I can use different buttons for different commands in Sage on my Hauppauge remote. Since I use FSE, I can use the "full" button for Commercial advace, and I gave up the "Mute" button so that I can use it for going to the previous commercial segment. You can also change stuff like making your up and down keys work as volume keys or vs. versa. At least thats how it works with the Hauppauge remote controls.

Its kind of a pain to configure so once you have one that works you want to make a back up of it. The Sage installation over writes the irremote.ini file so your changes will be lost if you don't have a backup.

Last edited by Humanzee; 03-09-2006 at 06:03 PM.
Reply With Quote
  #4  
Old 03-09-2006, 06:03 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
It is specifically for configuring the Hauppauge remote & is used only by Hauppauge's IR.exe software; it isn't used or accessed directly by SageTV (except for adding config stuff during installation).

IR codes (assigned to commands in Detailed Setup) that are learned by SageTV when using something like a USB-UIRT are stored in the properties file.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #5  
Old 03-09-2006, 07:45 PM
Humanzee's Avatar
Humanzee Humanzee is offline
Sage Fanatic
 
Join Date: Sep 2004
Location: North Idaho
Posts: 752
I modified your script to suit my system, worked like a charm. Thanks.
Reply With Quote
  #6  
Old 03-11-2006, 09:56 AM
Enormous's Avatar
Enormous Enormous is offline
Sage Aficionado
 
Join Date: Mar 2004
Location: D.C. Area
Posts: 398
Quote:
Originally Posted by Humanzee
I modified your script to suit my system, worked like a charm. Thanks.
Excellent! Glad I could help.
__________________
-Eric
Client: STX-HD100 Extender, Connected to 47" Visio 1080p LCD via HDMI, Running SageMC
Client: Media MVP Running SageMC
Server: Antec SLK3800B, AMD Athlon 64 X2 4200+, Biostar TForce 550, GeForce 7300LE, 1GB DDR2 800, 2 x HVR-1600, PVR-150MCE, 1.4TB HD Space, XP Pro, Java6, Latest SageTV Version
Reply With Quote
  #7  
Old 04-27-2007, 04:05 PM
itsanogo itsanogo is offline
Sage User
 
Join Date: Aug 2006
Posts: 62
What would i change in this script to get the backup on another drive than the C one?

Thank you,
__________________
itsa

Server: Intel Core 2 Quad Q8200 @ 2.33GHz, ASUS P5QL, 3GB RAM, 750 GB USB drive, WinTV-HVR-2250 Dual Tuner
2 SageTV Media Extender: MediaMVP (wired)
Software: SageTV 7.0.23 WHS
Reply With Quote
  #8  
Old 04-27-2007, 06:15 PM
Enormous's Avatar
Enormous Enormous is offline
Sage Aficionado
 
Join Date: Mar 2004
Location: D.C. Area
Posts: 398
Quote:
Originally Posted by itsanogo View Post
What would i change in this script to get the backup on another drive than the C one?

Thank you,
You would change the paths on the following lines (2 through 4) to reflect the way your system is set up:

Code:
SET SageTVDir=C:\Program Files\SageTV
SET backupDir=C:\Sage Backup\SageTV backups
SET windowsDir=C:\WINDOWS
SageTVDir is where you have SageTV installed (yours should be the same as mine, unless you specifically changed it).

backupDir is the base directory where you want the backups to go.

windowsDir is where you have windows installed (you should not have to change this line).

If I understand your question, you'll be wanting to change the path assigned to backupDir.
__________________
-Eric
Client: STX-HD100 Extender, Connected to 47" Visio 1080p LCD via HDMI, Running SageMC
Client: Media MVP Running SageMC
Server: Antec SLK3800B, AMD Athlon 64 X2 4200+, Biostar TForce 550, GeForce 7300LE, 1GB DDR2 800, 2 x HVR-1600, PVR-150MCE, 1.4TB HD Space, XP Pro, Java6, Latest SageTV Version
Reply With Quote
  #9  
Old 04-29-2007, 08:51 AM
itsanogo itsanogo is offline
Sage User
 
Join Date: Aug 2006
Posts: 62
Good job! It works really good!
After i back it up, i zip the backup into a single zip file onto my SageTV's recording external drive.

Thank you,
__________________
itsa

Server: Intel Core 2 Quad Q8200 @ 2.33GHz, ASUS P5QL, 3GB RAM, 750 GB USB drive, WinTV-HVR-2250 Dual Tuner
2 SageTV Media Extender: MediaMVP (wired)
Software: SageTV 7.0.23 WHS
Reply With Quote
  #10  
Old 05-13-2007, 02:29 PM
fontabg fontabg is offline
Sage User
 
Join Date: Apr 2005
Location: Mississauga, ON
Posts: 18
Thanks for creating the script one enhancement suggeston is if possible include a check of the previous drectories to that you can control the number as if you have it set to run on a schedule sooner or later you will need to manually delete the old entries. If if could be set to only keep the most recent xx days so it is always pruning.
Reply With Quote
  #11  
Old 05-15-2007, 07:26 PM
Enormous's Avatar
Enormous Enormous is offline
Sage Aficionado
 
Join Date: Mar 2004
Location: D.C. Area
Posts: 398
Quote:
Originally Posted by fontabg View Post
include a check of the previous drectories to that you can control the number as if you have it set to run on a schedule sooner or later you will need to manually delete the old entries. If if could be set to only keep the most recent xx days so it is always pruning.
Unfortunately, I don't actually know how to do that on the Windows side (more of a *nix scripter myself).

I wouldn't recommend using this script on a routine basis, because it creates a complete backup of your SageTV folder. I'm not sure how it is on your system, but on mine a single backup is over 200Mb! What I would suggest is manually using this script to do a complete backup each time you install a new version, and then do incremental backups of your sage.properties and wiz.bin files (among others). I know that at one point I had my system running a scheduled job that would just copy the important files on a regular basis.

Here is the thread detailing the procedure I used.

You could create a job for each day of the week, and have a rolling week's worth of backups if you needed them. Hope that helps.
__________________
-Eric
Client: STX-HD100 Extender, Connected to 47" Visio 1080p LCD via HDMI, Running SageMC
Client: Media MVP Running SageMC
Server: Antec SLK3800B, AMD Athlon 64 X2 4200+, Biostar TForce 550, GeForce 7300LE, 1GB DDR2 800, 2 x HVR-1600, PVR-150MCE, 1.4TB HD Space, XP Pro, Java6, Latest SageTV Version
Reply With Quote
  #12  
Old 01-14-2009, 08:26 AM
joey3002 joey3002 is offline
Sage Advanced User
 
Join Date: Dec 2008
Posts: 79
I am working on an update to this backup script to do a zip at the end for all the files so that it will be in 1 file.. Just easier to manage imo..
Reply With Quote
  #13  
Old 01-14-2009, 09:46 AM
joey3002 joey3002 is offline
Sage Advanced User
 
Join Date: Dec 2008
Posts: 79
ok, updated the backup script..

Notes
  • This was tested on XP with SP3
  • You need to download winrar for dos

You need to goto http://www.rarlab.com/download.htm and download the MSDos version. You need 2 files from that:
  1. rar32.exe
  2. rsx.exe

Put those files in the same location as your backup.bat file

Use the following new backup.bat
Code:
@echo off
SET SageTVDir=C:\Program Files\SageTV
SET backupDir=C:\Sage Backup\SageTV backups
SET windowsDir=C:\WINDOWS


FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%mm%-%dd%-%yyyy%
SET folderName=Sage backup %date%

MKDIR "%backupDir%\%folderName%"

ECHO Backing up SageTV Common directory
MKDIR "%backupDir%\%folderName%\Common"
XCOPY "%SageTVDir%\Common" "%backupDir%\%folderName%\Common" /s

ECHO Backing up SageTV directory
MKDIR "%backupDir%\%folderName%\SageTV"
XCOPY "%SageTVDir%\SageTV" "%backupDir%\%folderName%\SageTV" /s

ECHO Backing up Irremote.ini
COPY "%windowsDir%\Irremote.ini" "%backupDir%\%folderName%"
MOVE "%backupDir%\%folderName%\Irremote.ini" "%backupDir%\%folderName%\Irremote%date%.ini"

ECHO Doing the compression Part [joey3002 1-14-2009]
%backupDir%\rar32.exe a "%folderName%".rar "%backupDir%\%folderName%"

ECHO Delete Backed up Directory but KEEP compressed backup
rd /s /q "%backupDir%\%folderName%"

ECHO Backup for %date% complete

ECHO Remove this pause if you do not want to be prompted when this is done
pause
This will create a rar file that keeps the directory structure. Like Sage backup 01-14-2009.rar

Thanks to the orig poster for starting this fine backup batch file..
Reply With Quote
  #14  
Old 01-14-2009, 08:38 PM
Enormous's Avatar
Enormous Enormous is offline
Sage Aficionado
 
Join Date: Mar 2004
Location: D.C. Area
Posts: 398
Quote:
Originally Posted by joey3002 View Post
Thanks to the orig poster for starting this fine backup batch file..
Glad it's still relevant and helpful after all this time!
__________________
-Eric
Client: STX-HD100 Extender, Connected to 47" Visio 1080p LCD via HDMI, Running SageMC
Client: Media MVP Running SageMC
Server: Antec SLK3800B, AMD Athlon 64 X2 4200+, Biostar TForce 550, GeForce 7300LE, 1GB DDR2 800, 2 x HVR-1600, PVR-150MCE, 1.4TB HD Space, XP Pro, Java6, Latest SageTV Version
Reply With Quote
  #15  
Old 01-20-2009, 08:54 AM
MacDaddy MacDaddy is offline
Sage Aficionado
 
Join Date: Nov 2004
Location: Houston
Posts: 255
Saving my bacon

Was tinkering around with EG and some KVM swapping software over lunch yesterday. On a few of the swapping events, an unfortunate side effect was the ungracefull termination of Sage. I was eventually successful in getting the script right and polishing off the last of the orange beef. I returned to work and spent the rest of the afternoon defending the free world from Democracy. Came home and turned on the set to watch some recordings. EMPTY LIST. A few moments of panic and then I look in the SageTV subdirectory and spy the wiz.bin.corrupt0 entry.

In the old days, I would have screamed, pulled a few more hairs out and generally cursed the existence of all moderen technology. However after finding your little routine and putting it on autopilot, the worst I had to do was retrieve a day-old wiz.bin file. The better half never knew what was happening.

Thanks again for this little routine. I never really considered the value when tweaking it to run on my system, but I can tell you it's priceless when the time comes to recover.
__________________
Frankentivo: iStar D-380HB, SuperMicro X107-F-O, Xeon 1270v3 CPU, Kingston 8 GB 1600MHz DDRR3L x 4
Tuners: 4 x HDHR OTA, 4 x HDHR3 OTA, 3 x HDHR Prime
UnRAID Pro: 1 x Samsung 500GB Cache, 5 x WD Red 4TB (1 Parity, 4 Data)
Extenders: 2 x HD-200, 1 x HD-300 on Atlona PRO3HD66m
Sage: V9.0.14.567 with OpenDCT on unRaid docker, Gemstone, BMT, Web UI, PlayOn, TiSage
Reply With Quote
  #16  
Old 09-28-2009, 01:27 PM
MalibuDave42 MalibuDave42 is offline
Sage Advanced User
 
Join Date: Dec 2008
Location: Denver, CO
Posts: 81
Nice routine to back up for a update..gets everything. To use this for a daily backup is overkill. What exact list of files should be backed up daily?

win.bin
sage.properties
...
Reply With Quote
  #17  
Old 01-01-2010, 09:39 PM
crusader crusader is offline
Sage User
 
Join Date: Nov 2009
Location: Houston, TX
Posts: 68
I did some work on the original backup script too:
- now it stops on error and properly reports it via errorlevel -- i.e. caller can detect if smth went wrong (useful for automation, also prevents stupid things like removing all files at the root just because previous 'cd' failed)
- two modes -- manual and automatic, in manual script will stop (pause) on error
- logging via 'mtee' utility. It is relatively simple to automate log cleanup procedure (e.g. remove all log files older than 1 month)

Note:
- I do not backup Irremote.ini because I do not have any
- backup logic consists of two parts -- generic backup.bat wrapper (provides logging & some error handling magic) and batch script (e.g. SageTV.bat) with specific logic. It is quite extensible in this way.
- Usage:
Code:
backup <logic> [auto|manual]
second argument is optional and defaults to 'manual'

e.g.
Code:
backup SageTV auto
Enjoy! :-)
Attached Files
File Type: zip Backup.zip (7.4 KB, 577 views)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 12:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.