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

4 Answers4

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.

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.

JAL
  • 121
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.