What is the purpose of 'nice' command without a niceness parameter?

-1

I often see this code in anacrontab samples on the internet:

# environment variables
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
RANDOM_DELAY=30
# Anacron jobs will start between 6am and 8am.
START_HOURS_RANGE=6-8
# delay will be 5 minutes + RANDOM_DELAY for cron.daily
1               5       cron.daily              nice run-parts /etc/cron.daily
7               0       cron.weekly             nice run-parts /etc/cron.weekly
@monthly        0       cron.monthly            nice run-parts /etc/cron.monthly

'nice" command as explained by "man nice" if for changing a program priority with a niceness parameter. However I do not understand the 'nice' command in the above sample if we do not add a niceness parameter.

thierrybo

Posted 2018-01-28T15:10:22.007

Reputation: 21

what does nice take as default if you don't specify anything... – Solar Mike – 2018-01-28T15:23:22.290

Answers

4

From the manual:

   -n, --adjustment=N
          add integer N to the niceness (default 10)

So, nice run-parts /etc/cron.daily is actually the same as nice -10 run-parts /etc/cron.daily

Ljm Dullaart

Posted 2018-01-28T15:10:22.007

Reputation: 922

So I think I begin to understand. I believed it was useless because it set the value to the default. But this is not the overall default process niceness, it is the default for the nice command only (10). And it IS NOT necessarily what is the default niceness of the process (by the way most mine have 0 as niceness). Is this correct? – thierrybo – 2018-01-30T12:30:29.823

The default adjustment in the nice command is indeed something different then the default niceness of a process. I think it helps to use the term adjustment for the nice-command. – Ljm Dullaart – 2018-01-30T18:03:28.787