Talk:Handbrake userjob

From MythTV Official Wiki
Revision as of 15:44, 31 May 2012 by Reznor (talk | contribs)

Jump to: navigation, search

I'm on gentoo, mythbackend is started as root, so this user job will run as root as well.

What? No it isn't. The stock init script for Gentoo setuids to the mythtv user account. wagnerrp 06:43, 9 May 2012 (UTC)
You are right. I will correct this. - reznor

Detecting already running

On my system (mythtv 0.25, ubuntu 12.04), user jobs are launching as `sh -c /opt/` and there is another entry in `ps aux` for the resultant perl process. The script finds that shell process as another entry and thinks there is another script running. I modified to the below, which seems to work:

 my $curProcs = `ps aux | grep $scriptName | grep -v grep | grep -v "sh -c" | wc -l`;

This is my first user job, so maybe I've done something strange...but I don't think so. Bygottski 05:42, 31 May 2012 (UTC)

I'm not really sure what the intended purpose of that code is anyway. The jobqueue has an internal task limit that will prevent too many instances from being run simultaneously. I don't know why the script would need its own semaphore. wagnerrp 07:57, 31 May 2012 (UTC)
The purpose for this is limiting handbrake encoding jobs. Handbrake by default utilizes all cpu cores of the system for encoding. This code is intended to prevent heavy load on all cores by limiting simultaneous handbrake encoding jobs. I think there has been a handbrake command line switch to limit cpu core usage which is gone. Another approach would be using cpulimit.