Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 231203 - use ionice in /etc/cron.daily/mlocate
Summary: use ionice in /etc/cron.daily/mlocate
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-08 17:44 UTC by Daniel Pielmeier
Modified: 2012-02-02 20:19 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
mlocate.cron.diff (mlocate.cron.diff,538 bytes, patch)
2008-09-06 12:46 UTC, Daniel Pielmeier
Details | Diff
updatedb.conf.diff (updatedb.conf.diff,374 bytes, patch)
2008-09-06 12:46 UTC, Daniel Pielmeier
Details | Diff
mlocate-0.21.ebuild.diff (mlocate-0.21.ebuild.diff,407 bytes, patch)
2008-09-06 19:49 UTC, Daniel Pielmeier
Details | Diff
mlocate.cron.diff (mlocate.cron.diff,587 bytes, patch)
2008-09-06 19:50 UTC, Daniel Pielmeier
Details | Diff
mlocate-cron.conf (mlocate-cron.conf,186 bytes, text/plain)
2008-09-06 19:51 UTC, Daniel Pielmeier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Pielmeier gentoo-dev 2008-07-08 17:44:49 UTC
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
Comment 1 SpanKY gentoo-dev 2008-08-19 00:55:46 UTC
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 ...
Comment 2 Daniel Pielmeier gentoo-dev 2008-08-19 06:59:44 UTC
(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.

Comment 3 Daniel Pielmeier gentoo-dev 2008-09-06 12:46:18 UTC
Created attachment 164714 [details, diff]
mlocate.cron.diff

Patches for mlocate. They are done in the same way like slocate.
Comment 4 Daniel Pielmeier gentoo-dev 2008-09-06 12:46:42 UTC
Created attachment 164715 [details, diff]
updatedb.conf.diff
Comment 5 Daniel Pielmeier gentoo-dev 2008-09-06 18:34:36 UTC
(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?
Comment 6 Christian Faulhammer (RETIRED) gentoo-dev 2008-09-06 19:38:57 UTC
(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).
Comment 7 Daniel Pielmeier gentoo-dev 2008-09-06 19:49:38 UTC
Created attachment 164751 [details, diff]
mlocate-0.21.ebuild.diff

patched ebuild to install extra configuration file
Comment 8 Daniel Pielmeier gentoo-dev 2008-09-06 19:50:12 UTC
Created attachment 164753 [details, diff]
mlocate.cron.diff

changed cron file
Comment 9 Daniel Pielmeier gentoo-dev 2008-09-06 19:51:06 UTC
Created attachment 164754 [details]
mlocate-cron.conf

additional file to control nice and ionice in the mlocate cron job
Comment 10 Daniel Pielmeier gentoo-dev 2008-09-06 19:53:27 UTC
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.
Comment 11 Christian Faulhammer (RETIRED) gentoo-dev 2008-09-07 02:11:47 UTC
Synced updatedb.conf, applied your patches (one typo though).  Closing and thanks.
Comment 12 Daniel Pielmeier gentoo-dev 2008-09-07 06:31:24 UTC
(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.
Comment 13 Christian Faulhammer (RETIRED) gentoo-dev 2008-09-07 08:31:16 UTC
> (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.
Comment 14 Daniel Pielmeier gentoo-dev 2008-09-07 10:47:31 UTC
(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.
Comment 15 LuVar 2012-02-02 11:20:23 UTC
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.
Comment 16 SpanKY gentoo-dev 2012-02-02 20:19:26 UTC
please file a new bug