Read LPI Linux Certification in a Nutshell Online
Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger
Tags: #Reference:Computers
at
at [-ffile
]time
at [options
]
In the first form, enter commands to the
at
queue for execution attime
.
at
allows
fairly complex time specifications. It accepts times of the formHH:MM
to run a job at a specific time of
day. (If that time is already past, the next day is assumed.) You
may also specifymidnight
,noon
, orteatime
(4 p.m.), and you suffix a time of
day withAM
orPM
for running in the morning or evening.
You can also say what day the job will be run by giving a date in
month-day form, with the year being optional, or by giving a date inMMDDYY
,MM/DD/YY
, orDD.MM.YY
form. The date specification
must follow the time-of-day specification. You can also give times
such asnow +
count
, where
time-unitstime-units
can be minutes, hours, days,
or weeks. You can tellat
to run
the job today by suffixing the time withtoday
, and you can tell it to run the job
tomorrow by suffixing the time withtomorrow
.
If
-ffile
is
given, commands are taken from thefile
;
otherwise,
at
will prompt the user for
commands.
In the second form, list or delete jobs from the
at
queue.
job1
[,
job2
,
...]
Delete jobs from the
at
queue by
number (same as the
atrm
command).
-l
List items in the
at
queue (same as
the
atq
command).
Runmyprogram
once at 6:15
p.m. tomorrow:
$at 6:15pm tomorrow
at> myprogram
at>^D
In the previous code listing,^D
indicates that the user typed Ctrl-D on
the keyboard, sending the end-of-file character to terminate the
at
command.
Run commands that are listed in the file
command_list
at 9 p.m. two days from
now:
$at -f command_list 9pm + 2 days
List items in the
at
queue
(
root
sees all users’ entries):
$at -l
Remove job number 5 from the
at
queue:
$at -d 5
Using
at
to schedule jobs for delayed
execution, such as while you’re asleep or on vacation, is simple and
doesn’t require creation of a recurring
cron
entry.
In computing, internationalization and localization are
means of adapting computer software to different languages and regional
differences. Internationalization is the process of designing a software
application so that it can be adapted to various languages and regions
without engineering changes. Localization is the process of adapting
internationalized software for a specific region or language by adding
locale
-specific components and
translating text.
The terms are frequently abbreviated to the numeronyms i18n (where
18 stands for the number of letters between the first “i” and last “n” in
internationalization, a usage coined at Digital Equipment Corporation in
the 1970s or 1980s) and L10n respectively, due to the length of the words.
The capital “L” in L10n helps to distinguish it from the lowercase “i” in
i18n.
Since open source software can generally be freely modified and
redistributed, it is more amenable to internationalization. The KDE
project, for example, has been translated into over 100 languages.
The time zone under Linux is set by a symbolic link from
/etc/localtime
to a file in the
/usr/share/zoneinfo
directory that corresponds to
your specific time zone. Generally this is defined during the installation
process in order to provide the correct information to the system.
However, manually running the command
tzconfig
can
also do the job, and you won’t have to remember the path to the time
zones.
The
tzselect
program is a menu-based script
that asks the user for information about the current location, and then
sends the resulting time zone description to standard output. The output
is suitable as a value for the
TZ
environment
variable:
$tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#?
The
date
command can be used to print the
current Coordinated Universal Time (UTC):
$date -u
and also to show the time zone abbreviation:
$date +%Z
CET
A locale is a set of information that most programs use for
determining country- and language-specific settings. The following
environment variables are used to store locale
settings:
Defines all locale settings at once, while allowing further
individual customization via the
LC_*
settings
described next.
Defines alphabetical ordering of strings. This affects the
output of sorted directory listings, for example.
Defines the character-handling properties for the system. This
determines which characters are seen as alphabetic, numeric, and so
on. This also determines the character set used, if
applicable.
This defines the programs’ localizations for applications that
use a message-based localization scheme. This includes the majority
of GNU programs.
Defines currency units and the formatting of currency type
numeric values.
Defines formatting of numeric values that aren’t monetary.
This affects things such as the thousands separator and decimal
separator.
Defines the formatting of dates and times.
Defines the default paper size.
A special variable for overriding all other settings.
The
locale
utility writes information about
the current locale environment, or all public locales, to the standard
output. For the purposes of this section, a public locale is one provided
by the implementation that is accessible to the application. Issuing the
locale
command without any flags will output the
current configuration:
$locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
The C locale, also known as the POSIX locale, is the POSIX system
default locale for all POSIX-compliant systems.
The
iconv
utility converts the encoding of
characters in a file from one codeset to another and writes the results to
standard output.
The following example converts the contents of the file
in.txt
from the ISO/IEC 6937:1994 standard
codeset to the ISO/IEC 8859-1:1998 standard codeset, and stores the
results in the file
out.txt
:
$iconv -f IS6937 -t IS8859 in.txt > out.txt
As a system administrator in a multiuser environment, much of
your activity is related to maintaining various system services. These
services include accurate system time and logging of system events. The
following two Objectives are covered in this chapter:
Candidates should be able to properly maintain the system time
and synchronize the clock over NTP. Tasks include setting the system
date and time, setting the hardware clock to the correct time in UTC,
configuring the correct time zone for the system, and configuring the
system to correct clock drift to match the NTP clock. Weight:
3.
Candidates should be able to configure system logs. This
Objective includes managing the type and level of information logged,
manually scanning logfiles for notable activity, monitoring logfiles,
arranging for automatic rotation and archiving of logs, and tracking
down problems noted in logs. Weight: 2.
An accurate system clock is important on a Linux system for
a variety of reasons. Log entries need to be accurate so you can
accurately determine what system events occurred. Programs such as
make
and
anacron
require
accurate modification times on files. Network file sharing (such as NFS)
requires both client and server to keep accurate time so file operations
are kept in sync.
The most popular way to keep accurate time on an Internet-connected
Linux system is to use the
Network Time Protocol (NTP) and the NTP software package
from
http://www.ntp.org
.
NTP is used to set and synchronize the internal clocks of
network-connected systems. When properly configured, systems running the
NTP daemon can be synchronized within a few milliseconds (or better),
even over relatively slow WAN connections.
The NTP daemon also supports synchronization with an external time
source, such as a GPS receiver. Systems directly connected to an
external time source (and properly configured) are the most accurate, so
they are designated
stratum 1
servers. Systems
synchronizing to stratum 1 servers are designated
stratum
2
, and so on, down to stratum 15.
The NTP software package has support for cryptographic key-based
authentication, although setting this up is outside the scope of the
LPI Level 1 Exams and will not be covered here.
The NTP software package consists of several programs, including
the NTP daemon and a number of programs used to configure and query NTP
servers. The more commonly used programs from the package are listed
here.
Computer motherboards all contain a small battery that is
used to power the hardware clock. This ensures that the computer can
successfully keep track of the time even when it is powered off. In
Linux, you can configure this hardware clock and synchronize your system
clock to it (or vice versa). The importance of the hardware clock has
been somewhat minimized with the widespread use of NTP and easily
available, reliable time servers. However, for systems that aren’t
always connected to the Internet, an accurate hardware clock is an
important thing to have. Syncing a hardware clock is also required when
working with old hardware that suffers from time issues, such as BIOSes
that are not Y2K-aware.
Hardware clocks can suffer from the same drifts that system clocks
experience, causing them to slowly lose (or gain) time over a certain
period. The
hwclock
command is used in Linux to
control the hardware clock.
As stated previously, a time zone is just a positive or negative
value combined with UTC. Once you set the time zone on a Linux system,
applications will honor that positive or negative offset when they need
to use a timestamp. The time zone on a Linux system is identified by the
file
/etc/localtime
. This can be
either a data file itself or a symbolic link to a data file in the
directory
/usr/share/zoneinfo
.
/usr/share/zoneinfo
contains files that
represent every time zone. In order to set the time zone on your Linux
system, you must either copy one of these files to
/etc/localtime
or create a symbolic link from
/etc/localtime
to one of these files. For
example
, if your system is in the United
States in the Central time zone, your
/etc/localtime
file would look like this:
$ls –l /etc/localtime
lrwxrwxrwx 1 root root 30 Sep 12 13:56 \
/etc/localtime -> /usr/share/zoneinfo/US/Central
On the Exam
Make sure you understand the difference between system time and
the hardware clock, and the importance of keeping good system time.
Also remember the difference between local time and UTC, and how it
affects the time configuration on your Linux system.