MOTD

From Freephile Wiki

MediaWiki-Vagrant.png

The image above is a "Message Of The Day" or MOTD. It's presented as a sort of 'splash screen' when logging into a remote system via SSH. This article is about how to create your own custom MOTD.


The Ubuntu distribution introduced the update-motd framework which basically assembles the motd from the series of scripts in /etc/update-motd.d


You should read the motd manpage (which you can also access in your console via man update-motd Sadly, the motd man page doesn't even refer to update-motd which is where the details are!?)

Essentially, you create a file in /etc/update-motd.d with a numbered prefix and no suffix. The first line of output should be blank, and the last line of the script should be a carriage return.

cat /etc/update-motd.d/99-footer
#!/bin/sh
#
# modified from the MediaWiki-Vagrant setup for an installation of MediaWiki

rainbow_pipe () {
  local i=0 c
  while IFS= read data; do
    c=$(( 31 + ($i % 7) ))
    IFS=";" printf "\033[%sm" $c 1
    printf "%s\033[0m\n" "${data}"
    i=$((i+1))
  done
}
rainbow_pipe <<'EOM'

                 /
            .,. /
          ,mmmmn   ___  ___           _  _         _    _  _  _     _
  ,._   .,###"nI)  |  \\/  |          | |(_)       | |  | |(_)| |   (_)
 # ###########     | .  . |  ___   __| | _   __ _ | |  | | _ | | __ _
 # ############""  | |\\/| | / _ \\ / _` || | / _` || |/\\| || || |/ /| |
"  ####     #  ./  | |  | ||  __/| (_| || || (_| |\\  /\\  /| ||   < | |
   #'(#     #  "   \\_|  |_/ \\___| \\__,_||_| \\__,_| \\/  \\/ |_||_|\\_\\|_|
   #  ")     #
   #,  '"    '"
EOM
echo
printf " * MediaWiki is located at \033[33;1m/var/www/w/\033[0m.\n"
printf " * To interactively evaluate PHP and MediaWiki code, run '\033[33mhhvmsh\033[0m'.\n"
printf " * For a database shell, run '\033[33mmysql\033[0m'.\n"
printf " * To execute MediaWiki maintenance scripts, run '\033[33mphp -f ...\033[0m' in the maintenance/ folder.\n"
printf " * For help, visit \033[34;4mhttps://www.mediawiki.org\033[0m or \033[33m#mediawiki\033[0m on chat.freenode.net.\n\n"
printf " * For paid help, visit \033[34;4mhttp://eQuality-Tech.com\033[0m or email \033[33minfo@eQuality-Tech.com\033[0m\n\n"
 # there is a newline here. ignore this comment -- it's for illustration only