LinHES Forums
http://forum.linhes.org/

Mythcommflag Priority
http://forum.linhes.org/viewtopic.php?f=11&t=13362
Page 1 of 1

Author:  crasarx [ Sun Jan 07, 2007 8:08 pm ]
Post subject:  Mythcommflag Priority

It seems the default priority for 'low' CPU priority of mythcommflag (as can be set in the MythTV) is a nice priority of 17. I have to manually change it to 19 to ensure system stability. How do I change the default value from 17 to 19?

Author:  thornsoft [ Sun Jan 07, 2007 8:59 pm ]
Post subject: 

You can't. It's hard-coded way down deep in the program. I went looking one day, and it looked like it was turning into a big job. I'm hoping to get time to write a script to look for the commflag job and knock its value back to 19, but haven't gotten to it yet.
I may instead turn off the automatic one, and run commflag from crontab. This would give me flexibility in scheduling, so I could run from midnight-8:00, then again from 10AM -7PM M-F, but not on weekends. i.e. have it run when I'm never watch TV. I can get more flexibilty this way.
OTOH, this is just my "bright idea for today", and I may get distracted by some other shiny object tomorrow.

Author:  crasarx [ Wed Jan 10, 2007 11:10 pm ]
Post subject: 

Yeah, I just made a lil C++ script to automatically renice it and have it set to run in cron every minute.

Author:  turpie [ Tue Jan 16, 2007 4:50 pm ]
Post subject: 

Would you mind posting that script as I have had the same problem.

Thanks,

Author:  crasarx [ Wed Jan 17, 2007 12:13 am ]
Post subject: 

I'm sure there's a much, much much better way of doing this but I'm not much of a programmer so my solution was just to run this via a cronjob every minute.

Code:
#include <string>
#include <iostream>
#include <fstream>

using namespace std;

int main(){

  system("ps -e | grep mythcommflag > temp");
  system("du temp > temp2");
  int du = 0;
  ifstream disk("temp2");
  disk >> du;
  if(du == 0){
    return 0;
  }
  ifstream file("temp");
  char pid[10] = "";
  file >> pid;
  //  cout << "Pid is: " << pid << endl << endl;
  char command[255] = "renice 19 -p ";
  strncat(command, pid, 10);
  //  cout << "Command is: " << command << endl << endl;
  system(command);
  system("rm temp");
  system("rm temp2");
  return 0;

}

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/