LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-05-2006, 11:19 PM   #1
wuqso
LQ Newbie
 
Registered: Dec 2004
Location: China
Distribution: FC5
Posts: 28

Rep: Reputation: 15
Can I change the time of the automatic updatedb?


By default, the automatic updatedb always runs in the morning when I'm usually very busy in using linux. Can I change the running time of the updatedb to the afternoon when I'm not so busy?
 
Old 01-06-2006, 03:18 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
There is a file which may allow you to change that time: /etc/crontab. There is also a crontab utility that you can use to edit cron jobs.

The command 'apropos cron' in a console window (without quotes) will show you which utilities you have.
 
Old 01-06-2006, 06:14 AM   #3
wuqso
LQ Newbie
 
Registered: Dec 2004
Location: China
Distribution: FC5
Posts: 28

Original Poster
Rep: Reputation: 15
Thank you for your reply. But I still do not know how to change the default running time of the automatic updatedb. What are the meanings of the numbers in /etc/crontab file?
 
Old 01-06-2006, 07:10 AM   #4
lozza1978
LQ Newbie
 
Registered: Feb 2005
Posts: 23

Rep: Reputation: 15
Hi there

To change the time that updatedb runs, simply edit /etc/crontab/

~example~
01 * * * * root run-parts /etc/cron.hourly$
02 4 * * * root run-parts /etc/cron.daily$
22 4 * * 0 root run-parts /etc/cron.weekly$
42 4 1 * * root run-parts /etc/cron.monthly$


you will need to edit the time of cron.daily
as you can see my cron.daily runs at 4:02 everyday, simply changing the 4 to an 18 will meen updates get run at 18:02

HTH

Lozza
 
Old 01-07-2006, 04:22 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
What Cron Can Do For You
Cron allows users to automate repetitive system administration tasks such as tape backups, database reorganization, and general file cleanups (such as emptying log files and queues).
The Crontab File's Syntax
To tell cron what you want it to run, and how often you want it to run it, you need to create a crontab file. A crontab file is just a text file with the following syntax:
minute hour day-of-month month-of-year day-of-week command
Each of the above columns can be in one of the following formats (these examples are for the minute column):
30
Run command at 30 minutes past the hour.
0-59/10
Run command once every 10 minutes, for the entire hour.
15-30
Run command once every minute, from 15 to 30 minutes past the hour.
0,10,50
Run command at 0 minutes past the hour, 10 minutes past the hour, and 50 minutes past the hour.
*
Run command once every minute.
And here's the range of numbers available for each of the time and date columns:
minute : 0-59
hour : 0-23
day-of-month : 0-31
month-of-year: 1-12
day-of-week : 0-6
(0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sat)
Here's an example crontab file:
30 0 * * * ./backup.sh
0,10,50 9-15 * * * ./compute.sh
0-59/10 * * * 1,3,5 ./netgrab.sh
30 0 * * * ./backup.sh
Run the backup.sh script (located in your home directory) at half-past (30) midnight (0), on every day of the month (*), and every day of the year (*), and every day of the week (*).
0,10,50 9-15 * * * ./compute.sh
Run the compute.sh script every 0 minutes, 10 minutes, and 50 minutes past the hours (0,10,50), between 9am and 5pm (9-15), every day of the year.
0-59/10 * * * 1,3,5 ./netgrab.sh
Run the netgrab.sh script every 10 minutes (0-59/10), every Monday, Wednesday, and Friday (1,3,5).

Copied from Newbies Linux Manual, Automatings things with cron.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Do I need to run updatedb each time I search for a file or folder? lennysokol Linux - Software 4 05-30-2005 10:49 PM
updatedb and slocate runs at 5am, how can I change this? Archeantus Linux - Software 4 02-12-2005 05:06 PM
updatedb every time? akudewan Linux - Newbie 3 06-08-2004 11:35 AM
Updatedb & time Option mikeshn Linux - General 1 06-11-2003 11:09 PM
automatic updatedb zovres Linux - Newbie 1 04-01-2003 11:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:16 PM.

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