I am attempting to set nice and ionice for rsync via xinetd. I am running Fedora 16. The reason I would like to use these values is to reduce the rsync process to an idle state so other processes run unaffected.

I have tried to use /etc/default/rsync to set nice and ionice values, but it looks like these are not working for me. The rsync process is always started with a nice value of 0, even when I set it to 19. Do these settings work in xinetd? Is there another way to nice rsync via xinetd?

Here are my config files:


log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
<shares go here>


service rsync
    disable = no
    flags           = IPv6
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/bin/rsync
    server_args     = --daemon
    log_on_failure  += USERID



Thanks to pointers by sr_, I seem to have a solution.

In /etc/xinet.d/rsync I added/changed these lines:

service rsync
    nice            = 19
    server          = /usr/bin/ionice
    server_args     = -c 3 /usr/bin/rsync --daemon

To use ionice, I needed to change the server value to ionice instead of rsync. And then add rsync to the arguments section so that ionice launches it.

| improve this answer | |

These snippet of Debian's /etc/default/rsync (Fedora probably doesn't divert too much),

# run rsyncd at a nice level?
# ...

# run rsyncd with ionice?
# ...

makes me think that the *NICE values only affect the rsyncd daemon. Looking at /etc/init.d/rsync, we find

if [ -s $RSYNC_DEFAULTS_FILE ]; then
    case "x$RSYNC_ENABLE" in
        xtrue|xfalse)   ;;
        xinetd)         exit 0
# ... the next lines examine the *NICE variables...

i.e., if rsync is used with inetd, the *NICE values don't matter at all.

You could try replacing the rsync line in inetd.conf,

rsync   stream  tcp     nowait  root   /usr/bin/rsync rsyncd --daemon

with some command line setting your [io]nice values, I suppose.

Edit Scratch that last remark, you're using xinetd and thus, if you want to try it, have to change the rsync command in the snipped you included:

service rsync
    server          = /usr/bin/rsync

Edit2 Judging from this, there's a xinetd config item called nice for the niceness of the command:

nice    Changes the server priority like the nice command does.

So you could try a combination of setting nice=19 in /etc/xinetd.d/rsync and prepending the server command with some ionice call, e.g. ionice -c3.

(I'm not sure if this works, though. But if it doesn't, you can still run rsyncd as daemon and let the /etc/init.d script take care of everything.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.