Open System Services Management and Operations Guide (G06.30+, H06.08+, J06.03+)

Using the nice Command
The nice command lets you start an OSS process at a modified priority. All users can lower the
execution priority of a process, but only the super ID can increase the execution priority of a
process.
Priority values in a traditional UNIX system have a significance opposite that of the values used
on a NonStop server. For a description of the relationship among the nice value of a process,
the OSS scheduling priority for the process, and the Guardian priority for the process, see the
run(1), nice(1), and nice(2) reference pages either online or in the Open System Services
Shell and Utilities Reference Manual and Open System Services System Calls Reference Manual.
You can use the nice command to adjust the response time of servers that run in the OSS
environment. For example, to start the inetd process at a priority slightly higher than the default
priority, enter:
nice -n -1 /usr/ucb/inetd
To specify a lower priority for the inetd process, enter:
nice -n 15 /usr/ucb/inetd
This command executes the inetd process and decreases the priority by 15, which is a priority
even lower than the default priority set by nice.
Using an OSS Shell Script
Unlike a shell alias, the shell script method works for calls to a program from within another shell
script. To use an OSS shell script that changes the default priority of a program, follow these steps:
NOTE: Using shell scripts increases system overhead. Be sure that the performance tradeoff is
worthwhile before you use this technique.
Create a script file that has the same name as the program for which you want to change the
default priority. Put the following information in the script file:
#! /bin/sh
nice -n nn program_name
nn
is the priority adjustment for the process.
program_name
is the name of the program to be executed.
1. Place the script file in a special directory you control. Secure the file so that it can be executed
by everyone but not altered by anyone.
2. Add your special directory to the PATH environment variable used to find program files. You
need to do this only the first time you create such a script, provided you always use the same
OSS directory.
Most users use the PATH definition in /etc/profile, so change that file such that your
special directory is searched first.
3. Notify those users that have their own .profile file or otherwise alter the PATH variable
about what you are doing so that they can make comparable changes to their definitions of
PATH.
For example, to run a program called logout that is normally stored in /usr/bin with a priority
decreased by 5, do the following:
1. Put the following lines into a file named /usr/local/script/logout:
#! /bin/sh
nice -n 5 logout
2. Secure the file for only read and execute access by entering:
chmod a=rx /usr/local/script/logout
70 Operating the OSS Environment