| |||||||
| MediaPortal 1 Talk General talk regarding our HTPC-software MediaPortal 1 takes place here. |
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Portal Member | I thought I'd share my little scheduled task for backing up the MediaPortal installation, settings, and SQLExpress database using WinRar. The attached zip contains all of the necessary files. Extract the files into a folder on your hard drive and follow the instructions:
The backup jobs get named as such: "MediaPortalBackup (2008.04.22).rar". If you don't like this, you can change the format by modifying the "BackupName" and "DateFormat" SET variables in the .bat file. Just be careful as it may break the database backup file insertion (database backup is added using another call to Winrar using the generated date for filename. If too much time passes, the database backup will be in a newly generated rar). Old backups are deleted automatically when this batch file is run. You can specify how long to keep backups by setting the "DaysToKeepBackups" variable. Updates: 2008.04.22 - incorporated the deletion of old backup archives using the ForFiles.exe tool (thanks uggabugga) - added -dh switch to the Winrar command to attempt open (shared) file archiving 2008.04.23 - added documentation to batch file - added self-describing variable names 2008.04.23 - 14:30 - added MS SQL Express database backup support - modified MediaPortalDirs.txt paths to account for more readable base paths in the backup archive - added the -ep1 switch to turn off full path inclusion in the rar - changed the date format to a "daily" format to allow for database backup to be inserted into the archive. If the backup took over 1 minute, a new archive was created with the database instead of including it in the current backup archive. 2008.05.06 - Added set variables in main MediaPortalBackup.bat for database name and backup path/filename - Removed the hard-coding of paths for SQL backup location, database name, etc ![]() - Upgrade to Winrar 3.71 didn't like the database backup file insertion using -n"filepath". Took out -n and just used the path to file to fix Last edited by Terriff; 2008-05-06 at 09:12. |
| | |
| | #2 (permalink) |
| Docs Team Join Date: Aug 2007 Location: Sydney Age: 36
Posts: 673
Thanks: 35
Thanked 37 Times in 30 Posts
Country: | This looks good, I will add this to tips and tricks section on the wiki. I am assuming this can be run with MediaPortal open? Can this also be used for the TV Server? Well Done.
__________________ Bubble wrap is the solution to all of life's problems...!!! |
| | |
| | #3 (permalink) |
| MP Donator ![]() Join Date: Feb 2007 Location: Torshavn
Posts: 64
Thanks: 8
Thanked 0 Times in 0 Posts
Country: | Terrif: I have used this script for some time and happy to share it. I'll attach it as a text file so you need to rename the extension to .cmd. And of course you need to download forefiles.exe. M$ tool from some support pack(can't remember). Don't think I'm allowed to attach it to this post for copyright something... Forefiles.exe has to be in the same folder that the script is run from. Just make a schedule to run the batch file and that should be it. Do tell if you like this, so others can read this and use this solution too. ![]()
__________________ ######### #UggaBugga# ######### |
| | |
| | #4 (permalink) | |
| Portal Member | I have run it while MP was open with no problems. However, WinRar has a specific switch (-dh) that will try to open shared files for archiving purposes. I have added it to the batch file in the revised package (attached on the first post). Yes. Currently, the MediaPortalDirs.txt includes MediaPortal, TV Server, and the config directory (C:\Documents and Settings\All Users.....). You can add any paths you like to the MediaPortalDirs.txt file and they will be included in the backup rar file. Quote:
That's a quick and dirty way to clean up. Exactly what I needed.You can get the resource kit files here. Forfiles is included on the page. I've updated the MediaPortalBackup.bat to include the archive deletions as well (man, that forfiles syntax is picky. Don't add quotes around paths if you change the batch file). I've also cleaned up the paths somewhat by using variables. Hope this helps. Last edited by Terriff; 2008-04-23 at 07:23. | |
| | |
| | #5 (permalink) |
| Docs Team Join Date: Aug 2007 Location: Sydney Age: 36
Posts: 673
Thanks: 35
Thanked 37 Times in 30 Posts
Country: | Add a link to this thread on the wiki under MediaPortal 1/Tips and Tricks UserGuides - MediaPortal Wiki Documentation
__________________ Bubble wrap is the solution to all of life's problems...!!! |
| | |
| | #6 (permalink) | |
| MP Donator ![]() Join Date: Feb 2007 Location: Torshavn
Posts: 64
Thanks: 8
Thanked 0 Times in 0 Posts
Country: | Quote:
That's a quick and dirty way to clean up. Exactly what I needed.You can get the resource kit files here. Forfiles is included on the page. I've updated the MediaPortalBackup.bat to include the archive deletions as well (man, that forfiles syntax is picky. Don't add quotes around paths if you change the batch file). I've also cleaned up the paths somewhat by using variables. Hope this helps.[/quote] I see that you updated it and are now using the SET=XXX variable That's always easier if somone else wants to change the pathes and so on. Feel inner peace that I could somehow contribute with some knowledge ![]()
__________________ ######### #UggaBugga# ######### | |
| | |
| | #8 (permalink) | |
| Portal Member | Quote:
When I posted it and saw that it might actually get used, I figure that I should make it easier for others to change their settings (ie. change in one spot versus every instance). ![]() | |
| | |
| | #10 (permalink) | |
| MP Donator ![]() Join Date: Sep 2007 Location: Stockholm
Posts: 75
Thanks: 4
Thanked 5 Times in 5 Posts
Country: | I am having problems with this on Vista. I get the following message when I try and run the .bat Quote:
MpTvDbRC1 and TvLibrary. Why do I need to change to fix the backup? | |
| | |
![]() |
| Bookmarks |
| Tags |
| backup, database, including, scheduled, sqlexpress, winrar |
| Thread Tools | |
| Display Modes | |
| |