22.1 Information about Special Software Packages
The programs bash, cron, logrotate, locate, ulimit, and free, and the file
resolv.conf are very important for system administrators
and many users. Man pages and info pages are two useful sources of
information about commands, but both are not always available. GNU Emacs is
a popular and very configurable text editor.
22.1.1 The Package bash and /etc/profile
Bash is the default shell in SUSE® Linux Enterprise.
When used as a login shell, it reads several initialization files. Bash
processes them in the order they appear in this list.
-
/etc/profile
-
~/.profile
-
/etc/bash.bashrc
-
~/.bashrc
Custom settings can be made in ~/.profile or in
~/.bashrc. To ensure the correct
processing of these files, it is necessary to copy the basic settings from
/etc/skel/.profile or
/etc/skel/.bashrc into the home directory
of the user. It is recommended to copy the settings from
/etc/skel following an update. Execute the following
shell commands to prevent the loss of personal adjustments:
mv ~/.bashrc ~/.bashrc.old
cp /etc/skel/.bashrc ~/.bashrc
mv ~/.profile ~/.profile.old
cp /etc/skel/.profile ~/.profile
Then copy personal adjustments back from the
*.old files.
22.1.2 The cron Package
If you want to run commands regularly and automatically in the background at
predefined times, cron is the traditional tool to use. cron is
driven by specially formatted time tables. Some of of them come with the
system and users can write their own tables if needed.
The cron tables are located in
/var/spool/cron/tabs. /etc/crontab
serves as a systemwide cron table. Enter the username to run
the command directly after the time table and before the command. In Example 22-1, root is entered. Package-specific tables,
located in /etc/cron.d, have the same format. See the
cron man page (man cron).
Example 22-1
Entry in /etc/crontab
1-59/5 * * * * root test -x /usr/sbin/atrun && /usr/sbin/atrun
You cannot edit /etc/crontab by calling the command
crontab -e. This file must be loaded directly into an
editor, modified, then saved.
A number of packages install shell scripts to the directories
/etc/cron.hourly, /etc/cron.daily,
/etc/cron.weekly, and
/etc/cron.monthly, whose execution is controlled by
/usr/lib/cron/run-crons.
/usr/lib/cron/run-crons is run every 15 minutes
from the main table (/etc/crontab). This guarantees
that processes that may have been neglected can be run at the proper time.
To run the hourly,
daily, or other periodic maintenance scipts at
custom times, remove the time stamp files regulary using
/etc/crontab entries (see Example 22-2, which removes the
hourly one before every full hour, the
daily one once a day at 2:14 a.m., etc.).
Example 22-2
/etc/crontab: Remove Time Stamp Files
59 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
14 2 * * * root rm -f /var/spool/cron/lastrun/cron.daily
29 2 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
44 2 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly
The daily system maintenance jobs have been distributed to various scripts
for reasons of clarity. They are contained in the package aaa_base.
/etc/cron.daily contains, for example, the components
suse.de-backup-rpmdb,
suse.de-clean-tmp, or
suse.de-cron-local.
22.1.3 Log Files: Package logrotate
There are a number of system services (daemons) that,
along with the kernel itself, regularly record the system status and
specific events to log files. This way, the administrator can regularly check
the status of the system at a certain point in time, recognize errors or
faulty functions, and troubleshoot them with pinpoint precision. These log
files are normally stored in /var/log as specified by
FHS and grow on a daily basis. The logrotate package
helps control the growth of these files.
Configure logrotate with the file
/etc/logrotate.conf. In particular, the
include specification primarily
configures the additional files to read.
SUSE® Linux Enterprise ensures that programs that produce log files install
individual configation files in /etc/logrotate.d.
For example, such programs come with the packages
apache2
(/etc/logrotate.d/apache2) and
syslogd
(/etc/logrotate.d/syslog).
Example 22-3
Example for /etc/logrotate.conf
# 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
#}
# system-specific logs may be also be configured here.
logrotate is controlled through
cron and is called daily by
/etc/cron.daily/logrotate.
IMPORTANT:
The create option reads all
settings made by the administrator in
/etc/permissions*. Ensure that no conflicts arise from
any personal modifications.
22.1.4 The Command locate
locate, a command for quickly
finding files, is not included
in the standard scope of installed software. If desired,
install the package find-locate.
The updatedb process is
started automatically every night or about 15 minutes
after booting the system.
22.1.5 The Command ulimit
With the ulimit (user limits)
command, it is possible to set limits for the use of system resources and to
have these displayed. ulimit is especially useful for
limiting the memory available for applications. With this, an application
can be prevented from using too much memory on its own, which could bring
the system to a standstill.
ulimit can be used with various options. To limit memory
usage, use the options listed in Table 22-1.
Table 22-1 ulimit: Setting Resources for the User
-m |
Maximum size of physical memory |
-v |
Maximum size of virtual memory |
-s |
Maximum size of the stack |
-c |
Maximum size of the core files |
-a |
Display of limits set |
Systemwide entries can be made in
/etc/profile. There, enable creation of core
files, needed by programmers for debugging. A
normal user cannot increase the values specified in
/etc/profile by the system administrator, but can
make special entries in ~/.bashrc.
Example 22-4
ulimit: Settings in ~/.bashrc
# Limits of physical memory:
ulimit -m 98304
# Limits of virtual memory:
ulimit -v 98304
Memory amounts must be specified in KB. For more detailed information,
see man bash.
IMPORTANT:
Not all shells support ulimit directives. PAM (for
instance, pam_limits) offers comprehensive adjustment
possibilities if you depend on encompassing settings for these
restrictions.
22.1.6 The free Command
The free command is somewhat misleading if your goal is
to find out how much RAM is currently being used. That information
can be found in /proc/meminfo. These days, users with
access to a modern operating system, such as Linux, should not really
need to worry much about memory. The concept of available
RAM dates back to before the days of unified memory
management. The slogan free memory is bad memory
applies well to Linux. As a result, Linux has always made the effort to
balance out caches without actually allowing free or unused memory.
Basically, the kernel does not have direct knowledge of any applications or
user data. Instead, it manages applications and user data in a
page cache. If memory runs short, parts of it
are written to the swap partition or to files, from which they can
initially be read with the help of the mmap command (see
man mmap).
The kernel also contains other caches, such as the
slab cache, where the caches used for network access
are stored. This may explain differences between the counters in
/proc/meminfo. Most, but not all of them, can be
accessed via /proc/slabinfo.
22.1.7 The File /etc/resolv.conf
Domain name resolution is handled through the file
/etc/resolv.conf. Refer to Section 34.0,
The Domain Name System.
This file is updated by the script
/sbin/modify_resolvconf exclusively, with no other
program having permission to modify /etc/resolv.conf
directly. Enforcing this rule is the only way to guarantee that the system's
network configuration and the relevant files are kept in a consistent state.
22.1.8 Man Pages and Info Pages
For some GNU applications (such as tar), the man
pages are no longer maintained. For these commands, use the
--help option to get a quick overview of the info pages,
which provide more in-depth instructions. info is
GNU's hypertext system. Read an introduction to this system by
entering info info. Info pages can be
viewed with Emacs by entering
emacs -f info or directly in a
console with info. You can also use
tkinfo, xinfo, or the
SUSE help system to view info pages.
22.1.9 Settings for GNU Emacs
GNU Emacs is a complex work environment.
The following sections cover the
configuration files processed when GNU Emacs is
started. More information is available at https://www.gnu.org/software/emacs/.
On start-up, Emacs reads several files containing
the settings of the user, system administrator, and distributor for
customization or preconfiguration. The initialization file
~/.emacs is installed to
the home directories of the individual users from
/etc/skel. .emacs, in turn, reads
the file /etc/skel/.gnu-emacs. To
customize the program, copy .gnu-emacs
to the home directory (with cp /etc/skel/.gnu-emacs
~/.gnu-emacs) and make the desired settings
there.
.gnu-emacs defines the file
~/.gnu-emacs-custom as custom-file.
If users make settings with the customize options in
Emacs, the settings are saved to ~/.gnu-emacs-custom.
With SUSE® Linux Enterprise, the emacs package
installs the file site-start.el in the directory
/usr/share/emacs/site-lisp. The file
site-start.el is loaded before the
initialization file ~/.emacs. Among other things,
site-start.el ensures that special configuration files
distributed with Emacs add-on packages, such as
psgml, are loaded automatically.
Configuration files of this type are located in
/usr/share/emacs/site-lisp, too, and always begin with
suse-start-. The local system administrator can specify
systemwide settings in default.el.
More information about these files is available in the
Emacs info file under Init
File: info:/emacs/InitFile. Information about how
to disable loading these files (if necessary) is also provided at this
location.
The components of Emacs are divided into several
packages:
-
The base package emacs.
-
emacs-x11 (usually
installed): the program with X11
support.
-
emacs-nox: the
program without X11 support.
-
emacs-info: online
documentation in info format.
-
emacs-el: the
uncompiled library files in Emacs Lisp. These are not required at
runtime.
-
Numerous add-on packages can be installed if needed:
emacs-auctex (for LaTeX),
psgml (for SGML and XML),
gnuserv (for client and server
operation), and others.