LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-04-2014, 07:04 PM   #1
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191
Blog Entries: 1

Rep: Reputation: 15
Is there an easy way to set updatedb.mlocate to 'weekly' ?


I've read a few threads, but there doesn't seem to be an easy way to change the updatedb.mlocate to weekly, instead of daily. It's a bit of a hassle when it ties up the HD for a couple of minutes every day.

Anyone know of an easy way to do this?

thanks
 
Old 10-04-2014, 07:41 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,385

Rep: Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191Reputation: 4191
This is usually handled by cron, so move it to the weekly's.
I usually stop it altogether, and run it when I feel the need.
 
1 members found this post helpful.
Old 10-04-2014, 08:46 PM   #3
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
How can I stop it, then start it again when needed?
 
Old 10-05-2014, 01:25 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,815

Rep: Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238
Just make the file non-executable (chmod -x). To restore, just make it executable again.
 
Old 10-05-2014, 01:55 PM   #5
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
I don't know which file. Where is it? Sorry to be so dumb.
 
Old 10-05-2014, 01:59 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,815

Rep: Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238
For the daily jobs, look in /etc/cron.daily/ . The program that executes those jobs is called "run-parts". It has a manpage.
 
1 members found this post helpful.
Old 10-05-2014, 07:18 PM   #7
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 191

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Here's what's in my mlocate (/etc/chron.daily)-gedit
But I don't see any chmod -x or run-parts.


#! /bin/bash

set -e

[ -x /usr/bin/updatedb.mlocate ] || exit 0

if which on_ac_power >/dev/null 2>&1; then
ON_BATTERY=0
on_ac_power >/dev/null 2>&1 || ON_BATTERY=$?
if [ "$ON_BATTERY" -eq 1 ]; then
exit 0
fi
fi

# See ionice(1)
if [ -x /usr/bin/ionice ] &&
/usr/bin/ionice -c3 true 2>/dev/null; then
IONICE="/usr/bin/ionice -c3"
fi

flock --nonblock /run/mlocate.daily.lock $IONICE /usr/bin/updatedb.mlocate
 
Old 10-05-2014, 08:01 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,815

Rep: Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238Reputation: 2238
You need to change the permissions on the file /etc/cron.daily/mlocate to remove the execute permission. From a terminal, run
Code:
sudo chmod -x /etc/cron.daily/mlocate
To turn it back on, run
Code:
sudo chmod +x /etc/cron.daily/mlocate
But, even without restoring the execute permission, you can update the database at any time by running
Code:
sudo bash /etc/cron.daily/mlocate
Edit: Just to expand on what syg00 said in #2, to switch to a weekly schedule run
Code:
sudo mv /etc/cron.daily/mlocate /etc/cron.weekly/

Last edited by rknichols; 10-05-2014 at 08:06 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using mlocate - I'm learning littlejoe5 Linux - Software 1 07-04-2014 09:22 PM
manipulating locate (mlocate, slocate) behaviour ajaxStardust Linux - General 4 09-12-2012 08:17 PM
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory BallsOfSteel Linux - Newbie 4 12-11-2010 08:30 AM
updatedb crashes: src/updatedb.c:730: scan_cwd: Assertion `name_size > 1' failed sumanc Fedora 3 07-11-2008 04:39 PM
What's the difference between 'updatedb' and 'updatedb&' ?? DreameR-X Linux - Newbie 4 12-18-2004 04:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration