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, 08:04 PM   #1
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 189
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, 08:41 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,307

Rep: Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999
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, 09:46 PM   #3
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 189

Original Poster
Blog Entries: 1

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

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

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, 02:59 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,322

Rep: Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964
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, 08:18 PM   #7
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu 14.04
Posts: 189

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, 09:01 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,322

Rep: Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964Reputation: 1964
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 09: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 10:22 PM
manipulating locate (mlocate, slocate) behaviour ajaxStardust Linux - General 4 09-12-2012 09:17 PM
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory BallsOfSteel Linux - Newbie 4 12-11-2010 09:30 AM
updatedb crashes: src/updatedb.c:730: scan_cwd: Assertion `name_size > 1' failed sumanc Fedora 3 07-11-2008 05:39 PM
What's the difference between 'updatedb' and 'updatedb&' ?? DreameR-X Linux - Newbie 4 12-18-2004 05:36 PM

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

All times are GMT -5. The time now is 04:03 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration