2,479 bytes added
, 11:08, 25 March 2015
[[File: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 <code>/etc/update-motd.d</code>
You should read the [http://manpages.ubuntu.com/manpages/utopic/man5/update-motd.5.html motd manpage] (which you can also access in your console via <code>man update-motd</code> Sadly, the motd man page doesn't even refer to update-motd which is where the details are!?)
Essentially, you create a file in <code>/etc/update-motd.d</code> 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.
<pre>cat /etc/update-motd.d/99-footer</pre>
<source lang="bash" line="GESHI_FANCY_LINE_NUMBERS" highlight="15,34">
#!/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
</source>