University Systems --> WAM --> General WAM Information --> How to use renice to run a process in the background -->

How to use renice to run a process in the background

If you've already started a process and want to log off and keep it running in the background, you'll need to use the renice command. For example, you have myprog running, and you need to log off. First, you will need to determine what process id (PID) the program is using with the ps command:

ps -a | grep myprog

you should see something like:

9884 pts/4 0:20 myprog

This tells you that it's PID 9884 and is associated (currently) with tty4. The standard syntax for the renice command is:

renice -n PRI -p PID

where PRI is how you want to alter the priority of the process, and PID is the process id. To renice the process so you can log off and not have niceguy kill it, you would type:

renice -n 19 -p 9884

This would add 19 to the priority, lowering it to 19 (from the base of 0), thus rendering it safe from niceguy. It would then run when nothing else on the system needed to run, eventually completing without you needing to stay logged on.

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site