Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am not asking how to nice and renice a command on UNIX.

What happens is that on a particular machine into which I frequently log I am only allowed to run long-running processes with low priority (nice 19). Is there a way for all my commands on this machine to run as if I had "niced 19" them?

Inevitably I forget to prefix the command with "nice 19" when I start it, then need to go muck around in ps/top to locate the pid of my resource-hogging process and then renice it. Too much trouble, and I risk annoying the sysadmin; is there a way to do this by default?

many thanks! ~l

share|improve this question

migrated from stackoverflow.com Jul 21 '10 at 0:35

This question came from our site for professional and enthusiast programmers.

2  
It sounds like this is a sysadmin type question, about using an operating system rather than programming. It may be better suited for superuser.com. – JAL Jul 21 '10 at 0:31
up vote 3 down vote accepted

Assuming Bash, if your system supports this feature, place this in your ~/.bashrc or ~/.profile:

ulimit -e 19

You can try it from a command line first as a test.

share|improve this answer
    
thanks, that did the trick! – laramichaels Jul 22 '10 at 3:03

You might ask your sysadmin to look into adjusting limits.conf, a configuration file that is part of PAM and is located (on my Ubuntu system) in /etc/security.

A line like

@users hard priority 19

sets the default 'niceness' for processes started by user accounts.

share|improve this answer

This answer assumes your shell is bash.

Rather than mucking about in ps or top, just suspend the process(es) with Ctrl-z if they weren't launched that way (via &), and then run jobs -l to get a pid, renice that pid, and then continue the job's execution via bg (for BackGround) or fg (ForeGround).

share|improve this answer

Have you tried verynice? It's a bit old but still seems to be a program that might be excellent for your needs.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .