Author |
Message |
tjc
|
Posted: Fri Mar 07, 2008 6:55 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Too Many Secrets wrote: Also to note the idle.sh script needs to run as root for me.
Whoops, that's my fault, I used roots ability to run MySQL DB queries without giving a user name and password. It's easy to fix. Just add the login information to each of the mysql commands.
OK, that's fixed now... I still want to add some refinements like making the time range configurable and possibly adding some output controls (verbose versus silent or the like) but other than that I suspect that this is usable.
|
|
Top |
|
 |
tjc
|
Posted: Sat Mar 08, 2008 3:42 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
OK, the production ready version of idle.sh is now available from the wiki. Click the link to get it: Download idle.sh
Code: root@black2:~/scripts/backup# md5sum idle.sh 51cef4ae295a4204438a57565260d9de idle.sh root@black2:~/scripts/backup# sha1sum idle.sh 5cb3fc19f2961069071419317c206de339af06b9 idle.sh
|
|
Top |
|
 |
spideyk21
|
Posted: Sat Mar 08, 2008 8:32 pm |
|
Joined: Tue Sep 12, 2006 6:03 am
Posts: 210
Location:
Roseville, MI
|
Looking through the script I get the general gist of what is being done. I am just not sure how to implement it with/into a backup cron job.
_________________ -Roseville, Michigan USA LinHES R8: FE/BE, FE (x2)
|
|
Top |
|
 |
opel70
|
Posted: Sat Mar 08, 2008 9:39 pm |
|
Joined: Tue Apr 11, 2006 7:44 am
Posts: 287
Location:
Los Angeles, CA
|
spideyk21 wrote: I am just not sure how to implement it with/into a backup cron job.
This is what I have in my /etc/crontab:
Code: 10 03 * * */2 root /home/mythtv/idle.sh -s && /usr/local/bin/mythbackup >> /var/log/mythtv/mythbackup.log 2>&1
This runs my backup on Su, Tu, Th, Sa at 3:10a.
_________________ Tim
LinHES 8.4 HDHR3 BioStar A770, AMD X2 4050e, 2GB RAM GigaByte GeForce 8400, Chaintech AV710 USB-UIRT
|
|
Top |
|
 |
opel70
|
Posted: Sat Mar 08, 2008 9:44 pm |
|
Joined: Tue Apr 11, 2006 7:44 am
Posts: 287
Location:
Los Angeles, CA
|
I do have a question about the "inuseprograms" table. Mainly, what does it show? Currently, as far as I know, none of my Myth PCs are doing anything, and my "inuseprograms" has one entry. The single entry is for a recording that finished about 45 minutes ago. So, when will that entry be removed?
_________________ Tim
LinHES 8.4 HDHR3 BioStar A770, AMD X2 4050e, 2GB RAM GigaByte GeForce 8400, Chaintech AV710 USB-UIRT
|
|
Top |
|
 |
cecil
|
Posted: Sat Mar 08, 2008 9:52 pm |
|
 |
Site Admin |
Joined: Fri Sep 19, 2003 6:37 pm
Posts: 2659
Location:
Whittier, Ca
|
Could it be commercial flagging or a transcode job?
|
|
Top |
|
 |
opel70
|
Posted: Sat Mar 08, 2008 10:05 pm |
|
Joined: Tue Apr 11, 2006 7:44 am
Posts: 287
Location:
Los Angeles, CA
|
I checked and commflag is not running, and I haven't even looked at this new recording, much less configured it to transcode. Also, the "lastupdatetime" field contents show almost an hour ago. Additionally, that time is also almost an hour after the show finished recording. Guess it's just a housekeeping issue. Just would hate to have the backup not run just because I recorded something two hours ago.
And now it just updated again at the top of the hour. Though the recording finished two hours ago.
Hmmmm.
_________________ Tim
LinHES 8.4 HDHR3 BioStar A770, AMD X2 4050e, 2GB RAM GigaByte GeForce 8400, Chaintech AV710 USB-UIRT
|
|
Top |
|
 |
tjc
|
Posted: Sat Mar 08, 2008 10:08 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
spideyk21 wrote: Looking through the script I get the general gist of what is being done. I am just not sure how to implement it with/into a backup cron job. The script is intended to be called from your crontab command as described in detail here: http://knoppmyth.net/phpBB2/viewtopic.php?t=18000Another approach would be to set up a loop something like this in your script: Code: # Loop for 2 hours, checking every 10 minutes # Note that t is unused and the numbers are only to make the intent clear for t in 0 10 20 30 40 50 60 70 80 90 100 120 ; do # Is now a good time, or should we wait until later? if /usr/local/bin/idle.sh -s ; then /usr/locat/bin/mythbackup >/var/log/backup.log 2>&1 break else # System was still busy, try again later... sleep 600 fi done
opel70 wrote: I do have a question about the "inuseprograms" table. Mainly, what does it show? Currently, as far as I know, none of my Myth PCs are doing anything, and my "inuseprograms" has one entry. The single entry is for a recording that finished about 45 minutes ago. So, when will that entry be removed?
As Cecil indicated, active recording, watching, commercial flagging, transcoding, all get listed in the inuseprograms table.
|
|
Top |
|
 |
opel70
|
Posted: Sun Mar 09, 2008 12:00 pm |
|
Joined: Tue Apr 11, 2006 7:44 am
Posts: 287
Location:
Los Angeles, CA
|
Hmm, The entry is still in my "inuseprograms" table, some 18 hours later. So I opened "Live TV" on my PC, and closed it almost instantly. And now the entry is gone. I may need to check this tonight after my next program records and verify that this table is getting cleaned up properly on my system.
_________________ Tim
LinHES 8.4 HDHR3 BioStar A770, AMD X2 4050e, 2GB RAM GigaByte GeForce 8400, Chaintech AV710 USB-UIRT
|
|
Top |
|
 |
tjc
|
Posted: Sun Mar 09, 2008 12:16 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Yeah, that's not normal. On my system it tracks usage very closely. If you're watching a program it shows up there. If you're recording something it shows up there. If the system is commercial flagging or transcoding it shows up there. When any of those end the entry goes away. I've got a _few_ patches from the 0.20-fixes SVN branch applied on top of the vanilla R5F27 (mostly to .php files) but that's it.
|
|
Top |
|
 |
Too Many Secrets
|
Posted: Mon Mar 10, 2008 11:25 pm |
|
Joined: Fri Oct 20, 2006 12:04 pm
Posts: 905
Location:
LA, CA
|
FYI, I just noticed that the idle.sh script will still return a "planned recording" even if there is a Conflict and not really going to record. Again not a show stopper, but just a little odd.
|
|
Top |
|
 |
tjc
|
Posted: Tue Mar 11, 2008 8:43 am |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
The technique used to scan through the output of mythbackend --printsched is a bit crude and the safety margins at the beginning and end of recordings may contribute. Here is what the code does, maybe somebody can come up with a simple approach that is more robust.
- Take the count of recordings that overlap the window of interest from the DB query as an input.
- Use that count to isolate the first N items in the printsched output.
- Check those items for an assigned tuner number indicating a real recording.
One of the things I was trying to avoid was parsing times, as that's a notoriously miserable business. The other thing I wanted to avoid was having to capture the upcoming schedule matches rather than a simple count. There are cases where the algorithm above can err to the side of caution, such as when a recording has just completed, but I figured that was better than the other way... 
|
|
Top |
|
 |
knappster
|
Posted: Sun Mar 30, 2008 10:25 am |
|
Joined: Thu Sep 27, 2007 5:44 pm
Posts: 580
|
I have a couple of questions regarding this cron job.
1) Does running mythbackup give the same audio (voice) as if you navigate the menu on the frontend and select backup?
2) Since it is being backed up locally, should a user keep remote copies of this backup too? I have not had any problems where I would need to restore a backup, but the majority of the time is it to fix a configuration problem or to recover a catastrophic hardware failure?
I was just considering adding a separate cronjob to a desktop to copy the backup files once in a while.
BTW, to help other newbies like myself, there is more info about mythbackup here (wiki):
http://www.knoppmythwiki.org/index.php? ... storeHowTo
|
|
Top |
|
 |
md10md
|
Posted: Sun Mar 30, 2008 5:28 pm |
|
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
|
I tried this out and it looks like it would work great but unfortunately it's grabbing my deactivated upcoming recordings as potential recordings. Even if I do "./idle.sh -t 1" (or even -t .01) it says the system is busy. Any solutions?
|
|
Top |
|
 |
tjc
|
Posted: Sun Mar 30, 2008 5:50 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
md10md - Did you get the latest one from the wiki link, rather than the original one here? There are some tweaks in the newer one that make it smarter...
On the other hand, there are definitely ways that even the newest one is going to get a false positive, and since it errors to the side of caution... <shrug> To get around it you would have to makes the script a lot smarter which also means a lot more complicated.
Finally, if you included the complete output (along with the output of " mythbackend --printsched" it'd be a lot easier to help you troubleshoot your problem...
knappster wrote: 1) Does running mythbackup give the same audio (voice) as if you navigate the menu on the frontend and select backup? It runs the same script ( mythbackup) so it has exactly the same behavior. knappster wrote: 2) Since it is being backed up locally, should a user keep remote copies of this backup too?
Depends on how serious you are about it. I'd certainly recommend it. That's why my deepbackup.sh script copies everything to a separate disk.
|
|
Top |
|
 |