TUTORIAL: how to set an automatic backup of your scheduled records

Ir abajo

TUTORIAL: how to set an automatic backup of your scheduled records

Mensaje  matthelas el Vie Abr 23, 2010 12:14 pm

Hi all,

Did you ever notice, at night before going bed or after dinner, that there was no red light showing an ongoing TV recording on your MS4x0H despite you did scheduled one (worse, a weekly one for your preferred TV serie)?
Did you then power on your box, push timer rec and discover a terribly empty list, without any mention of the seven or more scheduled recordings you had to enter manually (since there is no correct epg...)?

If that already happened to you, there is now a solution, thanks to a software generated by Victor, that does backup of the current dB if not empty and restore it if empty.

NB: after discussion with Victor, this could not do the backup job correctly in case you have edited your schedule records database to add triggers so that records actually begin earlier and finish later. This indeed changes the size of the db. I did not use this btw very interesting trick because I usually records programs that have different types of time inaccuracies, sometimes bigger than 30min (since in the second half of the evening).

Disclaimer: usual one: by doing that, you are modifying the way your LG is actually working and the way LG planned your box to be working. Be careful, you can trash it, and will be the sole responsible of what you're doing with it, etc, etc.

What you need
You will need a telnet client, a working internet connexion (to keep it simple ... but you can also use a usb key to transfer the software), where both your pc/mac and your LG are connected. You will also need to know how to use vi, what is fairly simple in fact but you can not guess how it works (edition mode is set with a push on letter i to insert characters at the position where you stay in a file (before the place you are hovering over, then), a to append characters after that position, r to replace a single character under you position, uppercase R to replace more than one characters, esc to quit the edition mode, :wq to save and quit the file, :q! to quit the file without saving ...)
Also take a beer, I wrote a long thing :p

What to do
Here are the steps to get this solution up and running.


1- Adding an autorun: the rcS.addon script
ref: http://ms450h.forumactif.com/personnalisation-astuces-et-modding-f11/mise-au-point-d-un-autorun-t134.htm

Hopefully you already have set up an autorun, e.g. an rcS.addon script automatically launched at the end of the actual rcS, and can then directly go to step 3. Otherwise I would recommend to set it up now and takes benefit of editing the rcS for (web) remote control (optional step 2)

a- Telnet to the LG with your telnet client (I used Putty). Login is root , password is mugung ...

b- make a backup of your rcSfile (in case)
Código:
cp /usr/local/etc/rcS /usr/local/etc/OLDrcS1

c- Edit the rcS file
Código:
vi /usr/local/etc/rcS
then go to the end of the file (with the arrows of your keyboard for example), after the last word
then push the letter a (you are now in edition mode, appending something to the last word of the file)
then push enter to create a newline (or two Smile)
cut and paste the following code (right click of the mouse with Putty to paste it within the file):
Código:
( for i in 1 2 3 4 5 6 7 8 9 10; do /bin/sleep 6; if [ -f /tmp/hdd/root/rcS.addon ]; then  /tmp/hdd/root/rcS.addon; break; fi; done )& #rcS.addon
WARNING: this is a single line, not two or more!!
Then press escape key to go back to command mode and then put :wq followed by enter to save your change. You should be back to the initial telnet prompt.
Spoiler:
You can change the # part of place of its content, it's a comment, you can also add others but be very careful when modifying this file, otherwise you can "soft break" your receiver and then need to manually force a firmware update to reset its system. See here if needed:
http://ms450h.forumactif.com/tutos-f10/update-usb-en-cas-de-corruption-de-la-nand-t41.htm
If you did something wrong but can still telnet in the LG you can also restore the previous rcS:
cp /usr/local/etc/OLDrcS1 /usr/local/etc/rcS

d- create the rcS.addon file
Código:
touch /tmp/hdd/root/rcS.addon
chmod ugoa+x /tmp/hdd/root/rcS.addon
vi rcS.addon
Now you are editing the rcS.addon file, that is empty for the time being.
Goes to edition mode by pressing i and copy paste the following:
Código:
#!/bin/sh

# following command is to automatically start on the last DTT channel rather than on the home page
# uncomment the line with a # if you want to activate it BUT ONLY if you have modified your rcS file
# to add a tail -f /tmp/command_sender.txt |  pipe before the launch of RootApp and DVDPlayer, otherwise it won't work
# echo " " >> /tmp/command_sender.txt

Save the file: press escape and then :wq!
By doing this you have created a rcS.addon file that will be launched at the startup of the LG. By the way, since everything is commented out within that script, it will trigger nothing for the time being. The goal of creating it is to make sure you won't need later to modify the rcS file, if you want to launch extra things.


2- optional step: adapt the rcS to allow (web) remote control, zapping to DTV at launch, etc.
That step is absolutely not needed for the auto backup to run. But since you know how to modify the rcS script, let's try to do it once again, for the very last time (any future autorun will be set with the rcS.addon file created in step 1).
ref:
ES: http://ms450.forosactivos.net/tutoriales-f4/al-arrancar-va-directamente-a-ver-la-television-tdt-t272.htm
FR: http://ms450h.forumactif.com/tutos-f10/demarrage-automatique-sur-une-chaine-tv-t207.htm

a- Load the rcS file with vi
Código:
vi /usr/local/etc/rcS

b- Edit the first place (auto creation of buffer file that will relay commands to the LG programs)
Look for the right pattern by issuing, still in command mode, the following string:
Código:
/cd $DEFAULT_AP_DIR
(you can copy/paste)
Set your cursor at the end of this line (with your arrows) then goes to edition mode by pressing a
Insert one or two lines by pressing enter once or twice
Copy paste the following:
Código:
touch /tmp/command_sender.txt
Press enter and leave edition mode by pressing escape

c- Locate and edit the second place
still in command mode, search for the pattern DvdPlayer by writing /DvdPlayer
you should then have your cursor at a line looking like:
./RootApp DvdPlayer&
If not, search it by hand, it should not be very far
With your keyboard arrows, go to the beginning of the line, over the .
insert the tail-f command by pressing letter i and then copy pasting the following (last space included):
Código:
tail -f /tmp/command_sender.txt | 
Then leave the edition mode by pressing esc
The line should now look like:
tail -f /tmp/command_sender.txt | ./RootApp DvdPlayer&

d- Locate and edit the third place
A few lines below, you can see a line looking like:
./DvdPlayer&
With your keyboard arrows, go to the beginning of the line, over the .
insert the tail-f command by pressing letter i and then copy pasting the following (last space included):
Código:
tail -f /tmp/command_sender.txt | 
Then leave the edition mode by pressing esc
The line should now look like:
tail -f /tmp/command_sender.txt | ./DvdPlayer&

e- save the rcS and never touch it again later Smile
press the following sequence in command mode :wq followed by enter
You should be back to the telnet session


3- get the software thanks to your internet connexion
go the right place and download Victor's backup program by copy pasting the following in the telnet sessions
Código:
cd /tmp/hdd/root
wget http://dl.dropbox.com/u/684543/varios/ms450h/Aplicaciones/RecListBackup/RecListBackup2
chmod ugoa+rx ./RecListBackup2
The last line will allow this software to be "launched" (automatically or not)


4- edit the rcS.addon script
Código:
vi rcS.addon
If you followed step 2 and want that the LG starts on the last DTT channel rather than on the home page, goes over the # of the line
# echo " " >> /tmp/command_sender.txt
Hit the r button and then space (you went in edition mode for only one letter, and replaced # by a space)
In any case, you want to add the backup soft in the autorun, so goes to the end of the file with you arrows, press a and enter to create a new line and copy paste the following 4 lines:
Código:
# This command launch a backup or restore of the schedule_record.db depending of the state of the file
# if empty (below a certain size), it restore the previous db, otherwise it saves it
/tmp/hdd/root/RecListBackup2

Then press escape to leave the edition mode. If you think there are too many empy lines within your rcS.addon script, goes over the ones in excedent and press dd and they will be discarded.
Save your file by issuing :wq followed by enter.

You should be back to the telnet session


5- reboot the box:
either do power on/power off with the remote control or put reboot in the command line


And here, you're done Smile


Última edición por matthelas el Vie Abr 23, 2010 1:24 pm, editado 3 veces

matthelas

Mensajes : 145
Fecha de inscripción : 08/02/2010

Ver perfil de usuario

Volver arriba Ir abajo

Re: TUTORIAL: how to set an automatic backup of your scheduled records

Mensaje  vic1972 el Vie Abr 23, 2010 12:33 pm

GUAYYY Smile
Thanks very much for the tutorial.

regards
avatar
vic1972

Mensajes : 2260
Fecha de inscripción : 09/12/2009
Edad : 46
Localización : Malaga

Ver perfil de usuario

Volver arriba Ir abajo

Re: TUTORIAL: how to set an automatic backup of your scheduled records

Mensaje  matthelas el Vie Abr 23, 2010 1:12 pm

Lol, you deserved a special effort Smile

Thanks for the soft!!

Cheers,
Matt

matthelas

Mensajes : 145
Fecha de inscripción : 08/02/2010

Ver perfil de usuario

Volver arriba Ir abajo

Re: TUTORIAL: how to set an automatic backup of your scheduled records

Mensaje  Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.