Open main menu

MOTD

Revision as of 11:09, 25 March 2015 by Freephile (talk | contribs)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)

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
 1 #!/bin/sh
 2 #
 3 # modified from the MediaWiki-Vagrant setup for an installation of MediaWiki
 4 
 5 rainbow_pipe () {
 6   local i=0 c
 7   while IFS= read data; do
 8     c=$(( 31 + ($i % 7) ))
 9     IFS=";" printf "\033[%sm" $c 1
10     printf "%s\033[0m\n" "${data}"
11     i=$((i+1))
12   done
13 }
14 rainbow_pipe <<'EOM'
15 
16                  /
17             .,. /
18           ,mmmmn   ___  ___           _  _         _    _  _  _     _
19   ,._   .,###"nI)  |  \\/  |          | |(_)       | |  | |(_)| |   (_)
20  # ###########     | .  . |  ___   __| | _   __ _ | |  | | _ | | __ _
21  # ############""  | |\\/| | / _ \\ / _` || | / _` || |/\\| || || |/ /| |
22 "  ####     #  ./  | |  | ||  __/| (_| || || (_| |\\  /\\  /| ||   < | |
23    #'(#     #  "   \\_|  |_/ \\___| \\__,_||_| \\__,_| \\/  \\/ |_||_|\\_\\|_|
24    #  ")     #
25    #,  '"    '"
26 EOM
27 echo
28 printf " * MediaWiki is located at \033[33;1m/var/www/w/\033[0m.\n"
29 printf " * To interactively evaluate PHP and MediaWiki code, run '\033[33mhhvmsh\033[0m'.\n"
30 printf " * For a database shell, run '\033[33mmysql\033[0m'.\n"
31 printf " * To execute MediaWiki maintenance scripts, run '\033[33mphp -f ...\033[0m' in the maintenance/ folder.\n"
32 printf " * For help, visit \033[34;4mhttps://www.mediawiki.org\033[0m or \033[33m#mediawiki\033[0m on chat.freenode.net.\n\n"
33 printf " * For paid help, visit \033[34;4mhttp://eQuality-Tech.com\033[0m or email \033[33minfo@eQuality-Tech.com\033[0m\n\n"
34  # there is a newline here. ignore this comment -- it's for illustration only