LWN.net Logo

Xorg

Xorg

Posted Mar 15, 2007 16:55 UTC (Thu) by vmole (guest, #111)
In reply to: Xorg by k8to
Parent article: RSDL hits a snag

Like "I would always like autofoo and libtool to run with nice at least 5" or some such.

Create file nice_5 in /usr/local/bin (or ~/bin):

#!/bin/bash
exec nice -5 "$@"

Then create links in /usr/local/bin (or ~/bin):

ln -s nice_5 gcc
ln -s nice_5 libtool
ln -s nice_5 autobarf

Put /usr/local/bin (or, need I say, ~/bin) early in your path.


(Log in to post comments)

autobarf??

Posted Mar 15, 2007 21:58 UTC (Thu) by pr1268 (subscriber, #24648) [Link]

Is autobarf a standard Unix/Linux shell program? I can't seem to find it on my Slackware system.

;-)

Xorg

Posted Mar 16, 2007 2:46 UTC (Fri) by njs (guest, #40338) [Link]

> exec nice -5 "$@"

I believe you mean:

exec nice -5 "$0" "$@"

Xorg

Posted Mar 16, 2007 17:25 UTC (Fri) by vmole (guest, #111) [Link]

Oops. You're absolutely correct. Sorry about that, to anyone trying this at home.

Xorg

Posted Mar 27, 2007 23:29 UTC (Tue) by efexis (guest, #26355) [Link]

Only if you want a script which perpetually exec's itself... otherwise, you'll need to put the absolute path in to the original binary it's meant to be calling, or drop the location of the script from the PATH env.

eg, for background running tasks, such as make:
exec nice 5 "/usr/bin/$0" "$@"

Xorg

Posted Mar 16, 2007 15:17 UTC (Fri) by k8to (subscriber, #15413) [Link]

Yeah i'm currently using such a trick to run i386 binaries, and another similar trick for a special file database maintenance task. I'm kind of uneasy with them in terms of unexpected complexity springing out at the user in the troubleshooting case.

Xorg

Posted Mar 23, 2007 15:57 UTC (Fri) by slamb (guest, #1070) [Link]

I think it'd need to be a bit more clever than that - the shell doesn't replace $PATH, so this will just exec itself over and over. You'll need to either specify a more limited path or manually walk $PATH, excluding symlinks to itself.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds