On our development server, we have a bunch of shell script wrappers for Java JARs. Using the CRON scheduler, we do fire these scripts daily for different purposes.
For performance testing, we would like to renice a script’s PID to a priority of 1 at runtime.
Right now, we do it from the command line or using TOP.
Is there a way to do that within the shell script itself without “doing harm” to the process as well as other processes?
This should work:
Afterwards the script itself will have a nice value of 1. This will also apply to all new children, although not to previously forked ones.