Backgrounding process with higher priority

I have been troubleshooting a mysterious performance problem with the nightly batch programs on our primary system for quite some time and just found something very interesting. All batch processes are running with a nice value of 24. I don't know what the default is on other systems but I do know that on HP-UX the default is 20.

I then did some investigating to find out that all processes that run in the background with an "&" automatically run with an offset of (+)4. And this coincides with the problems we've been seeing that when users start logging on in the morning the batch times increase significantly.

Does anyone have any suggestions on how to fix this? Is there a default setting I can change for this. We actually want the batch to finish as quickly as possible and if anything should be running with an offset of -4.

# renice 20 -p <pid> ?

You're right that I could issue a renice command. The problem is that there are 1000s of processes started during the batch. All of these process should have a higher priority than all of the user processes with a nice value of 20.

It seems to me that it would complicate things tremendously if I had to run a separate script after every process to determine the previous process' PID and then to renice it. I also think that this would be detrimental to the overall performance of the whole batch.

I also need a way to allow a non-superuser to renice a negative value. And can anyone tell me a way to determine a process nice value without using Top or Glance?

set +o bgnice
is the command to tell the shell to not renice background jobs. Just run that command before you launch your background jobs.