Difference between revisions of "Motd"

From ArchWiki
Jump to: navigation, search
(Merge with Core utilities?)
Line 1: Line 1:
{{stub}}
+
{{Merge|Core utilities}}
 
[[Category:System administration]]
 
[[Category:System administration]]
 
[[zh-CN:Motd]]
 
[[zh-CN:Motd]]
Line 5: Line 5:
  
 
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.
 
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:
+
A sample script that can be used to create {{ic|/etc/motd}}:
 
  #!/bin/bash
 
  #!/bin/bash
 
  #define the filename to use as output
 
  #define the filename to use as output

Revision as of 16:32, 17 March 2014

Merge-arrows-2.pngThis article or section is a candidate for merging with Core utilities.Merge-arrows-2.png

Notes: please use the second 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 that can be used to create /etc/motd:

#!/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