Difference between revisions of "Motd"

From ArchWiki
Jump to: navigation, search
(15 intermediate revisions by 9 users not shown)
Line 1: Line 1:
motd (Message of the day). This file is found in /etc that is displayed whenever
+
{{stub}}
some user log in, except they've specified a quiet login in their shell profile.
+
[[Category:System administration]]
 +
[[zh-CN:Motd]]
 +
[[Wikipedia:motd (Unix)|motd]] (Message of the day). The  contents  of {{ic|/etc/motd}} are displayed by {{Ic|login(1)}} after a successful login but just before it executes the login shell.
  
A good place to display your Terms of Service to remind users of your local policies
+
It is a good place to display your Terms of Service to remind users of your local policies or anything you wish to tell them.
or anything you wish to tell.
+
A sample script:
 
+
Here is my script to create a MotD with some useful Information.
+
 
  #!/bin/bash
 
  #!/bin/bash
 
  #define the filename to use as output
 
  #define the filename to use as output
  motd="motd"
+
  motd="/etc/motd"
 
  # Collect useful information about your system
 
  # Collect useful information about your system
  # $USER is automtically defined
+
  # $USER is automatically defined
 
  HOSTNAME=`uname -n`
 
  HOSTNAME=`uname -n`
 
  KERNEL=`uname -r`
 
  KERNEL=`uname -r`
Line 23: Line 23:
 
  echo -e "$R#=============================================================================#" >> $motd
 
  echo -e "$R#=============================================================================#" >> $motd
 
  echo -e " $W Welcome $B $USER $W to $B $HOSTNAME                " >> $motd
 
  echo -e " $W Welcome $B $USER $W to $B $HOSTNAME                " >> $motd
  echo -e " $R ARCH  $W= $ARCH                                     " >> $motd
+
  echo -e " $R ARCH  $W= $ARCH                                   " >> $motd
 
  echo -e " $R KERNEL $W= $KERNEL                                " >> $motd
 
  echo -e " $R KERNEL $W= $KERNEL                                " >> $motd
 
  echo -e " $R CPU    $W= $CPU                                    " >> $motd
 
  echo -e " $R CPU    $W= $CPU                                    " >> $motd
 
  echo -e "$R#=============================================================================#" >> $motd
 
  echo -e "$R#=============================================================================#" >> $motd
 
  echo -e "$X" >> $motd
 
  echo -e "$X" >> $motd
 
Just copy the new created file called motd from the current directory to /etc ('''WARNING:''' if already a file called motd exists it will be overwritten)
 

Revision as of 13:01, 13 June 2012

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Motd#)
motd (Message of the day). The contents of /etc/motd are displayed by login(1) after a successful login but just before it executes the login shell.

It is a good place to display your Terms of Service to remind users of your local policies or anything you wish to tell them. A sample script:

#!/bin/bash
#define the filename to use as output
motd="/etc/motd"
# Collect useful information about your system
# $USER is automatically defined
HOSTNAME=`uname -n`
KERNEL=`uname -r`
CPU=`uname -p`
ARCH=`uname -m`
# The different colours as variables
W="\033[01;37m"
B="\033[01;34m"
R="\033[01;31m" 
X="\033[00;37m"
clear > $motd # to clear the screen when showing up
echo -e "$R#=============================================================================#" >> $motd
echo -e "	$W Welcome $B $USER $W to $B $HOSTNAME                " >> $motd
echo -e "	$R ARCH   $W= $ARCH                                   " >> $motd
echo -e "	$R KERNEL $W= $KERNEL                                 " >> $motd
echo -e "	$R CPU    $W= $CPU                                    " >> $motd
echo -e "$R#=============================================================================#" >> $motd
echo -e "$X" >> $motd