January 2004
Intermediate to advanced
368 pages
7h 25m
English
There are many times when it's useful to change the priority of a specific task, whether it's an IRC or chat server that's supposed to use only "spare" cycles, an MP3 player app or file download that has become less important, or a real-time CPU monitor being increased in priority. The renice command, however, requires you to specify the process ID, which can be a hassle. A much more useful approach is to have a script that matches process name to process ID and then renices the specified application.
#!/bin/sh # renicename - Renices the job that matches the specified name. user=""; tty=""; showpid=0; niceval="+1" # initialize while getopts "n:u:t:p" opt; do case $opt in n ) niceval="$OPTARG"; ;; ...
Read now
Unlock full access