pam_motd Сравнение версий

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

wiki:руководство_по_ubuntu_server:другие_полезные_приложения:pam_motd [2012/11/03 13:42]
создано
wiki:руководство_по_ubuntu_server:другие_полезные_приложения:pam_motd [2012/11/03 19:46] (текущий)
[pam_motd]
Строка 8: Строка 8:
 =====pam_motd===== =====pam_motd=====
  
-When logging into an Ubuntu ​server you may have noticed the informative ​Message Of The Day (MOTD). ​This information is obtained and displayed using a couple of packages:+При входе на сервер ​Ubuntu ​вы можете заметить информативное сообщение дня (Informative ​Message Of The Day MOTD). ​Эта информация собирается и отображается с использованием пары пакетов: 
 +  -- **landscape-common**:​ предоставляет основные библиотеки для **landscape-client**,​ который может использоваться для управления системой с помощью web приложения **Landscape**. Пакет включает утилиту /​usr/​bin/​landscape-sysinfo,​ которая используется для сбора информации,​ выводимой в MOTD. 
 +  -- **update-notifier-common**:​ используется для автоматического обновления MOTD через модуль **pam_motd**.
  
-    landscape-common:​ provides the core libraries of landscape-client,​ which can be used to manage systems using the web based Landscape application. The package includes the /​usr/​bin/​landscape-sysinfo utility which is used to gather the information displayed in the MOTD. +**pam_motd** выполняет сценарии в /​etc/​update-motd.d ​в порядке чисел, предваряющих имена файловВывод сценариев записывается в /​var/​run/​motd ​с сохранением порядковых номеров и затем объединяется с /​etc/​motd.tail.
- +
-    update-notifier-common:​ is used to automatically update the MOTD via pam_motd module. +
- +
-pam_motd ​executes the scripts in /​etc/​update-motd.d ​in order based on the number prepended to the scriptThe output of the scripts is written to /​var/​run/​motd, keeping the numerical order, then concatenated with /​etc/​motd.tail. +
- +
-You can add your own dynamic information to the MOTD. For example, to add local weather information:​ +
- +
-    First, install the weather-util package: +
- +
-    sudo apt-get install weather-util +
- +
-    The weather utility uses METAR data from the National Oceanic and Atmospheric Administration and forecasts from the National Weather Service. In order to find local information you will need the 4-character ICAO location indicator. This can be determined by browsing to the National Weather Service site. +
- +
-    Although the National Weather Service is a United States government agency there are weather stations available world wide. However, local weather information for all locations outside the U.S. may not be available. +
- +
-    Create /​usr/​local/​bin/​local-weather,​ a simple shell script to use weather with your local ICAO indicator:+
  
 +Вы можете добавить вашу собственную динамическую информацию к MOTD. Например,​ добавить информацию о погоде:​
 +  -- Сначала установите пакет **weather-util**:​
 +  .. <​code>​sudo apt-get install weather-util</​code>​
 +  -- Утилита **weather** использует данные METAR из //National Oceanic and Atmospheric Administration//​ и прогнозы от //National Weather Service//. Чтобы найти информацию для вашего региона вам потребуется 4-хсимвольный индикатор местоположения ICAO. Он может быть определен при заходе на сайт [[http://​www.weather.gov/​tg/​siteloc.shtml|National Weather Service]].
 +  .. Несмотря на то, что National Weather Service является правительственным агентством США, оно имеет доступ к данным от погодных станций по всему миру. Однако локальная информация о погоде может предоставляться не для всех мест за пределами США.
 +  -- Создайте файл /​usr/​local/​bin/​local-weather,​ простейший shell сценарий,​ использующий **weather** с вашим ICAO индикатором местоположения:​
 +  .. <​code>​
     #!/bin/sh     #!/bin/sh
     #     #
Строка 41: Строка 34:
     weather -i KINT     weather -i KINT
     echo     echo
 +</​code>​
 +  -- Сделайте файл сценария выполняемым:​
 +  .. <​code>​sudo chmod 755 /​usr/​local/​bin/​local-weather</​code>​
 +  -- Создайте символьную ссылку в /​etc/​update-motd.d/​98-local-weather:​
 +  .. <​code>​sudo ln -s /​usr/​local/​bin/​local-weather /​etc/​update-motd.d/​98-local-weather</​code>​
 +  -- Наконец выйдите из сервера и войдите повторно чтобы увидеть новое сообщение MOTD.
  
-    Make the script executable:​ +Теперь вы будете получать приветствия с некоторой полезной информацией и информацией о погодекоторая может быть не такая полезнаяНадеемся пример с **local-weather** продемонстрировал гибкость **pam_motd**.
- +
-    sudo chmod 755 /​usr/​local/​bin/​local-weather +
- +
-    Nextcreate a symlink to /​etc/​update-motd.d/​98-local-weather:​ +
- +
-    sudo ln -s /​usr/​local/​bin/​local-weather /​etc/​update-motd.d/​98-local-weather +
- +
-    Finally, exit the server and re-login to view the new MOTD. +
- +
-You should now be greeted with some useful information,​ and some information about the local weather that may not be quite so usefulHopefully the local-weather ​example demonstrates the flexibility of pam_motd.+
  
 ---- ----