3

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

1
  • 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, 2010 at 0:31

4 Answers 4

3

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.

0
2

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.

0

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).

0

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

Update 2019-02-06: link updated.

2
  • Linky no worky no more. What was verynice?
    – Jé Queue
    Feb 6, 2019 at 16:27
  • 1
    Oh wow, 2010 called, it wanted its answer back. Link updated. :) Feb 6, 2019 at 17:01

You must log in to answer this question.

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