Question about nice

Dan Nelson dnelson at allantgroup.com
Tue Nov 16 07:56:35 PST 2004


In the last episode (Nov 16), David J. Weller-Fahy said:
> I've set a very few commands as NOPASSWD in sudo, and run them from
> my normal user's crontab.  I've seen some examples of crontab's that
> use nice, but none that use sudo and nice.  That led me to a few
> questions. All paths have been stripped stripped - sudo and isoqlog
> are in
> /usr/local/bin, nice is in /usr/bin.
> 
> 1. I understand nice is useful if you need to run a program at a
> certain priority.  Is nice useful when not passing a priority?  If
> so, what is the difference between the following two commands (in
> terms of priority level)?
> 
> nice isoqlog
> isoqlog

man nice: 

    The nice utility runs utility at an altered scheduling priority, by
    incrementing its `nice'' value by the specified increment, or a
    default value of 10.
 
> 2. If it is useful to run nice without passing a priority, then are
> the following two commands equivalent?  If not, which one would be
> preferred and why?
> 
> nice sudo isoqlog
> sudo nice isoqlog
> 
> I've been reading a bit, but haven't found a definite answer yet.  My
> feeling is that the answer to number one (first portion) is no, and
> thus the answer to number 2 (first portion) is no.  I'd be happy to be
> proven wrong, though. ;]

The first may take longer to execute on a busy machine, since sudo
itself is running at a lower priority.  The 2nd may be a security
hazard, depending on whether you allowed "nice isoqlog" or just "nice"
(with any command) in your sudo config file.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list