LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2004, 01:46 PM   #1
dominant
Member
 
Registered: Jan 2004
Posts: 409

Rep: Reputation: 30
Fundamental automated tasks


What are the fundamental automated tasks through crontab that a server has to do?

Self-maintenance
 
Old 02-17-2004, 08:08 PM   #2
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
That would depend on what type of server it is. A mail server is going to need to do different things to a file server, a *ahem* CD server, etc, etc. One thing that should be done on all machines, servers or otherwise, is logrotate.
 
Old 02-18-2004, 04:14 AM   #3
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
How to do that?
simply

0 3 * * * /sbin/logrotate /var/log/messages

Is that ok?
 
Old 02-18-2004, 08:45 AM   #4
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
My crontab has the following entries:
Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
# Minute, hour, day-of-month, month, day-of-week 
*/15 * * * * root nice -19 /etc/cron.d/logperms.cron
01 * * * * root nice -n 19 run-parts /etc/cron.hourly
02 16 * * * root nice -n 19 run-parts /etc/cron.daily
22 17 * * 0 root nice -n 19 run-parts /etc/cron.weekly
42 18 1 * * root nice -n 19 run-parts /etc/cron.monthly
The command run-parts basically runs any scripts it find in the given directory. Under /etc/cron.daily I have a script called logrotate that contains
Code:
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
The configuration file it uses contains
Code:
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/lastlog {
    monthly
    rotate 1
}

# system-specific logs may be configured here
So there you have it. That is how my logrotate works. The cron entry you have wouldn't work as the command logrotate requires a config file rather than pointing to a directory.
 
Old 02-18-2004, 09:39 AM   #5
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
alright, and how logrotate finds where the log files reside?
 
Old 02-18-2004, 10:16 AM   #6
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
In the logrotate.conf file it says that "RPM packages drop log rotation information into this director" and then lists /etc/logrotate.d. In that dir there are yet more files, each a config file corresponding to a service that generates logs that need to be rotated. Try saying that after a few beers

Basically, cron reads from the script that tells it to run logrotate. logrotate reads from the logrotate.conf file that tells it to look in /etc/logrotate.d to get information about which logs need rotating.

I doubt very much that /etc/logrotate.d is RPM specific, so it should work on any system.
 
Old 02-20-2004, 12:59 PM   #7
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
Alright, i think that suse does logrotation automatically, doesn't it?
 
  


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
Arch has fundamental personality issues otchie1 Arch 13 11-23-2005 09:16 PM
The Fundamental Differences Between Linux and Windows Charred Linux - News 23 10-30-2005 01:50 AM
Fundamental Question in C and C++ linux_ub Programming 5 07-28-2004 12:26 PM
Partition fundamental questions jfchui Linux - Newbie 7 04-23-2004 07:47 AM
Fundamental ipchains concept questionn... WeNdeL Linux - Security 2 12-19-2002 12:38 PM


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