Open System Services Management and Operations Guide (G06.29+, H06.07+)

Operating the OSS Environment
Open System Services Management and Operations Guide527191-005
2-31
Managing OSS Process Scheduling
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:
1. 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.
2. 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.
3. 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.
4. 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
3. Change the PATH environment variable in /etc/profile to something similar to
the following:
export PATH=/usr/local/script:/bin:/bin/unsupported:
/usr/ucb:/usr/bin
Note. Using shell scripts increases system overhead. Be sure that the performance tradeoff is
worthwhile before you use this technique.