User:Flyser/Low maintenance Gentoo

From Gentoo Wiki
Jump to: navigation, search
Important
This is only a draft version of this article and far from being complete yet.

This article aims to collect instructions and scripts to reduce the maintenance overhead of gentoo to a minimum.

Use Cron

This is an advice rather than actual instruction and should be a no-brainer, but I want to mention it nonetheless: Whenever you need to execute the same tasks periodically, use a cron daemon.

Depending on the type of the task and the system, you may choose a traditional cron daemon such as vixie-cron or dcron or you might prefer a cron implementation that tries to be slightly more intelligent such as anacron, which is often a good choice of non-server systems.

Use atd

atd is a daemon, which allows users to schedule commands to run at one specific time. For example:

 $ at 1145 jan 29
 at> cc -o foo foo.c
 at> ^D #(press Control-D while at the beginning of a line)

Runs cc -o foo foo.c at 11:45 on the 29th January.

Set up a system logger

Unless you skipped this part of the gentoo installation guide, you should already have one. If you do, pause for a moment and ponder if its configuration could be improved.

Install ntpd

The ntp daemon is a convenient way to keep the clock of an unix system in sync. While you could also run ntp manually once in a while, the daemon solution is preferable as it uses the adjtime syscall to avoid large time jumps. Here is how you do it:

root #emerge net-misc/openntpd
root #mkdir -p /var/lib/openntpd/chroot

then, optionally edit /etc/ntpd.conf and run

root #rc-update add ntpd default
root #/etc/init.d/ntpd start

Note that the system time will not change immediately after starting the daemon. Be patient.

Set up logrotate

Set up local mail delivery

Hard drive monitoring with smartd

Automatic system updates

Warning
This is a very dangerous thing to do and will break your system at some point!

First create the following script and make sure it's executable:

FILE /root/autoupdate.shAutomatically updates a gentoo system
'"`UNIQ--pre-00000002-QINU`"'

then add it to your crontab, e.g. like so

FILE crontab entry to run the automatic update every day at 03:00 in the night
   0     3      *      *      *      /root/autoupdate.sh
ToDo
Send mail to inform about etc-update, elog, ...

Automatic installation of security fixes

glsa-check

Automatic kernel updates