Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 2004 09:56:33 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Question about nice
Message-ID:  <20041116155632.GD80412@dan.emsphone.com>
In-Reply-To: <20041116144450.GA70461@weller-fahy.com>
References:  <20041116144450.GA70461@weller-fahy.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041116155632.GD80412>