Words by c.z.robertson

Dream priority launcher

2004-06-27 05:30:42 GMT/BST

I have a vision for a piece of software I want for Linux. Someone must have done it before, but I can't find it.

The aim is to allow non-root users to easily get higher than ordinary priority on multimedia apps that root has explicitly approved. It would work like this: There would be a config file in /etc which would contain a list of trusted apps and the priority levels they were allowed to run at. It might look something like this:

# Give players some boost
/usr/bin/rhythmbox    -5
/usr/bin/xmms         -5

# Give editors more boost
/usr/bin/audacity     -10

Then there would be a little wrapper program that started these apps with the right priority, so if you ran

dream-priority-launcher /usr/bin/xmms myfile.mp3

XMMS would start with a priority of -5.

It wouldn't be at all difficult to write. Indeed, I might do it myself someday. But surely someone's done it already. There are other far more sophisticated tools such as VeryNice and AND, but I don't really want something that runs as a daemon. I also don't want to create wrapper scripts for each program individually.

Suggestions?

Updated 2004-07-04: Earlier versions said "higher than ordinary privileges" when what I meant to say was priority. Cut me some slack. I was writing at five in the morning.

sudo

sil - http://www.kryogenix.org/

2004-07-04 23:19:00 GMT/BST

Wouldn't it be pretty easy to do with sudo? I mean, dream-priority-launcher itself could be a shell script that did

nice `grep $0 /etc/d-p-l | sed 's/ \+/ /g' | cut -f2 -d" "` $*

and you set up sudo so that the user can call only /usr/bin/dream-priority-launcher, and then do

sudo dream-priority-launcher /usr/bin/baz

or something? That way, the shell script doesn't have to be suid (which isn't allowed anyway iirc), because it's actually being *run* by root through sudo.

Gotta watch out for people playing with IFS and stuff, mind.

colin_zr - http://rtnl.org.uk

2004-07-29 14:35:49 GMT/BST

<p>Sorry, I didn't explain myself properly. What you're proposing runs the actual program as root, but I want it to run as the user but just with a negative nice value. </p><p> I suppose d-p-l could do an su back to the original user... I can't, off the top of my head, figure out how to make it work though.</p>