Quando si esegue l'accesso con una versione server di Ubuntu, è possibile vedere dei messaggi giornalieri di informazioni (MOTD). Queste informazioni sono ricavate e visualizzate utilizzando diversi pacchetti:
landscape-common: fornisce le librerie principali di landscape-client, che può essere utilizzato per la gestione di sistemi attraverso l'interfaccia web di Landscape. Il pacchetto comprende l'utilità /usr/bin/landscape-sysinfo che può essere usata per recuperare informazioni visualizzate attraverso il MOTD.
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 script. The output of the scripts is written to /var/run/motd
, keeping the numerical order,
then concatenated with /etc/motd.tail
.
È possibile aggiungere delle informazioni dinamiche per il messaggio giornaliero. Per esempio, per aggiungere informazioni meteo locali:
Installare il pacchetto weather-util:
sudo apt-get install weather-util
L'utilità weather utilizza i dati METAR dalla «National Oceanic and Atmospheric Administration» e le previsioni meteo dal «National Weather Service». Per reperire informazioni locali è necessario il codice a 4 cifre ICAO. Per ottenere questo codice è possibile consultare il sito web del National Weather Service.
Benché il «National Weather Service» sia un'agenzia governativa degli Stati Uniti d'America, stazioni meteo sono disponibili in tutti il mondo. Informazioni meteorologiche potrebbero però non essere disponibili per tutte le località al di fuori del territorio americano.
Creare il file /usr/local/bin/local-weather
, un semplice script per usare weather con il proprio indicatore ICAO locale:
#!/bin/sh # # # Prints the local weather information for the MOTD. # # # Replace KINT with your local weather station. # Local stations can be found here: http://www.weather.gov/tg/siteloc.shtml echo weather -i KINT echo
Rendere lo script eseguibile:
sudo chmod 755 /usr/local/bin/local-weather
Next, create 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 useful. Hopefully the local-weather example demonstrates the flexibility of pam_motd.