PDA

View Full Version : How to determine PID for setpri



DarkWing
10-25-2002, 05:17 PM
I've been playing with cron, and it causes audio glitches when it kicks off a process (tested with simple SendKey and noppv). So I did my reading and got SetPri and ran it...however it requires a PID contrary to how other people are running it.

I see people putting it in scripts as 'setpri fifo 1' but if you run it that way it spits out usage info that says it wants a PID. Ok, no problem, I did a 'ps -x' got the PID for cron and ran it 'setpri fifo 1 548' and it fixed the audio glitching...Great.

Here's the problem...the PID won't be the same at each boot up, so how can I automatically run setpri against the cron process?

Someone suggested that I parse the output of 'ps -x' but I don't have the scripting ability to do that.

Or perhaps there's a way to permanently assign a priority to cron? Nice? I think it was AlphaWolf that said it doesn't really set the priority of a process?

Need a nudge in the right direction, Thanks.

Torg
10-25-2002, 06:03 PM
You missing a pice to do it. Normaly you would grep the process.

ps x | grep process

it should return to you the line in the ps listing of the process. Of couse it can also show you the grep process itself (especaily on that slower then pond scum tivo), so..

ps x | grep process | grep -v grep

that is grep process from the ps listing excluding any lines with grep in them.

Now how do you get the pid from that. Well they are sed, awk and cut. None of these tools are available on the Tivo. So you will need to install it. It is easy to compile, but easier to simply download it :)

http://www.dealdatabase.com/forum/showthread.php?s=&threadid=15812&highlight=awk

genericuser
10-28-2002, 03:36 PM
setpri fifo 1 $$

$$ is a shell variable that means the currently running processes PID. If you put this in the rc.sysinit, then ALL processes started after that line will run at that priority.

There was a sticky thread that describes this.

Hope that helps.

DarkWing
10-28-2002, 04:03 PM
Ahh cool! Exactly what I needed. Thanks generic...looks like I didn't read close enuf :)

keith721
10-28-2002, 09:09 PM
better than running grep twice, fake out the shell, like this:


# ps -ax | grep [s]etpri

and you'll only find the setpri process(es), and not your grep command, since the text of the shell command you entered doesn't match what grep understands you're searching for...

keith721