Sometimes when updatedb is running it is rather annoying because it sucks much disk I/O. So I thought it would be a good idea to use ionice in combination with nice for the cron script. I searched the net and found that the Ubuntu people already do this[1,2]. What do you think about this? [1] https://bugs.launchpad.net/ubuntu/+source/findutils/+bug/134692 [2] http://launchpadlibrarian.net/9631597/slocate_3.1-1ubuntu2.dsc.diff
rlocate doesnt really make sense ... it doesnt run a periodic cronjob the Ubuntu patch has syntax errors (wonder if they realize it ...). so ive implemented it myself for our slocate-3.1-r2. http://sources.gentoo.org/sys-apps/slocate/files/slocate-3.1-cron2.patch?rev=1.1 just need to update mlocate ...
(In reply to comment #1) > rlocate doesnt really make sense ... it doesnt run a periodic cronjob Oh, I did not know about this. I know mlocate and slocate use the cronjob so I was under the impression rlocate does this too. > the Ubuntu patch has syntax errors (wonder if they realize it ...). so ive > implemented it myself for our slocate-3.1-r2. > http://sources.gentoo.org/sys-apps/slocate/files/slocate-3.1-cron2.patch?rev=1.1 Thanks for implementing this! Where are the syntax errors? I just saw your approach looks a bit cleaner as it saves one if statement for instance. > just need to update mlocate ... What is the differnce in checking for /usr/bin/updatedb instead of /usr/bin/slocate. I guess that way it can be applied in a similar way for mlocate.
Created attachment 164714 [details, diff] mlocate.cron.diff Patches for mlocate. They are done in the same way like slocate.
Created attachment 164715 [details, diff] updatedb.conf.diff
(In reply to comment #4) > Created an attachment (id=164715) [edit] > updatedb.conf.diff > Okay it does not work the same way as slocate because updatedb from mlocate exits when it gets unknown options. So possibilities are using an extra configuration file to set nice and ionice values for the cron job, hard coding the values in the cron file or patch mlocate so it does not exit when it gets unknown options. I don't know if patching is difficult maybe it is just enough to remove case UCT_IDENTIFIER: error_at_line (0, 0, UPDATEDB_CONF, uc_line, _("unknown variable `%s'"), uc_lex_buf); goto skip_to_eol; from src/conf.c. Have not tested this yet. I for now use the extra configuration file option. Or are there probably other possibilities?
(In reply to comment #5) > So possibilities are using an extra configuration file to set nice and ionice > values for the cron job, hard coding the values in the cron file or patch > mlocate so it does not exit when it gets unknown options. I am all for extra configuration file. If you prepare everything and test it I happily commit it (bit short on time).
Created attachment 164751 [details, diff] mlocate-0.21.ebuild.diff patched ebuild to install extra configuration file
Created attachment 164753 [details, diff] mlocate.cron.diff changed cron file
Created attachment 164754 [details] mlocate-cron.conf additional file to control nice and ionice in the mlocate cron job
By the way, is it possible that the updatedb.conf for mlocate is from slocate. They look the same but are not completely the same. If possible they could be adjusted.
Synced updatedb.conf, applied your patches (one typo though). Closing and thanks.
(In reply to comment #11) > Synced updatedb.conf, applied your patches (one typo though). Closing and > thanks. > Which typo? Do you mean? --- mlocate/mlocate.cron 2008-09-07 08:15:45.000000000 +0200 +++ mlocate-new/mlocate.cron 2008-09-07 08:16:42.000000000 +0200 @@ -4,14 +4,14 @@ then if [ -f /etc/updatedb.conf ] then - args="" + args="" else - args="-f proc" + args="-f proc" fi if [ -f /etc/mlocate-cron.conf ] then - . /etc/mlocate-cron.conf + source /etc/mlocate-cron.conf fi # run on active process in case ionice isnt installed, or So besides the different indention the only difference I see is the usage of (source config) vs (. config). I always thought it makes no difference which one is used. I took the dot as it was the same for slocate.
> (In reply to comment #11) > > Synced updatedb.conf, applied your patches (one typo though). Closing and > > thanks. > > > > Which typo? Do you mean? No, this one: + doins "${FILESDIR}/mlocate-cron.conf" + fperms 0644 /etc/mlocate.conf Perms are not set on the right file. (In reply to comment #12) > So besides the different indention the only difference I see is the usage of > (source config) vs (. config). I always thought it makes no difference which > one is used. I took the dot as it was the same for slocate. There is no difference but I think the dot is really non-obvious and people could miss to see it.
(In reply to comment #13) > > No, this one: > + doins "${FILESDIR}/mlocate-cron.conf" > + fperms 0644 /etc/mlocate.conf > > Perms are not set on the right file. Aargh, copy-paste, thanks for spotting. > > There is no difference but I think the dot is really non-obvious and people > could miss to see it. > Okay thanks for the clarification and for putting this into the tree.
Hi, can someone have look at updatedb start? On my system I have set up that ionice should be class 3 (idle): /etc/updatedb.conf # ionice class to run at: see -c in ionice(1) IONICE_CLASS="3" But it is not applied. I see in iotop that update db is running with default ionice priority (be/4). I have AMD64 platform.
please file a new bug