EDIT: 2017-01-08
Igor Rzegocki has a project that uses the same technique outlined here to make some incredible ready-made Street FIghter MotDs – it is really cool, and if you are interested in abusing ansi escape sequences to make MotDs you should check it out :)
Everyone universally agrees that most Message of the Days (MOTDs) are stupid and suck. By the end of reading this post, your mind grapes should be swollen with the knowledge of how to make an MOTD that isn’t stupid and, some would say, doesn’t suck.
Prerequisites ¶
- Imagemagick
- OpenJDK
- coreutils
- perl
- git
This should have you covered:
Creating the Util-say file ¶
I use Util-Say to create motd messages. I started out using img2xterm, but I’ve found I get better results with Util-Say.
$ git clone https://github.com/maandree/util-say
$ cd util-say
$ ./img2ponysay -- yourimg.png > yourimg.txt
You can also try ./img2ponysay -2 -- youimg.png > yourimg.txt
but I’ve never had good results with that
MOTD-ifying ¶
On CentOS and Debian, I usually just throw the ponysay file directly into /etc/motd
and maybe add on some other useful info:
$ sudo cat yourimg.txt > /etc/motd
$ sudo figlet "$(hostname)" >> /etc/motd
$ sudo printf "Public IP: $(dig +short myip.opendns.com @resolver1.opendns.com)\n" >> /etc/motd
On Ubuntu Boxes (since they use update-motd(1)), I do pretty much the same thing except I just make a bash script in /etc/update-motd.d/25-baller-motd
#!/usr/bin/env bash
cat yourimg.txt
figlet "$(hostname)"
printf "Public IP: $(dig +short myip.opendns.com @resolver1.opendns.com)\n"
command -v fortune &> /dev/null && fortune
There are likely better articles on creating a useful MOTD, (here’s one that looks kinda cool) but there are exactly none-better articles on creating MOTDs that are so flossy!
This seems pretty cool but I get “Unable to access jarfile ./util-say.jar” Any ideas?
Make sure you have the util-say.jar file (
find /path/to/util-say -name 'util- say.jar'
), make sure your permissions are correct (I assume that read permissions are probably fine, but you may need execute—I also assume that the git repo likely has correct permissions), and also make sure you’re in the correct directory when you run ./img2ponysay—probably won’t work running/home/user/Downloads/util-say/img2ponysay
.I say “Probably” because I’ve never tested that theory.
img2ponysay keeps complaining about “Unable to access jarfile ./util-say.jar”, how do i generate or download this file? i can’t find it online
I think the jar used to be included in the util-say repo. You may have to generate it now: try running
make
inside the util-say repo and see where that gets you.yup, make did the trick! thank you! its now working but with a small caveat (easy to fix anyway). When i run cat on the generated TXT or when is displayed as the MOTD, some characaters display before the image:
balloon5
$$
$$
$$
Fixed by editing the TXT file and erasing those lines at the begining, but, is it caused by something i missed? is there a way to prevent that from happening?
I’m trying to implement a dynamic auto-generated MOTD
BTW, thanks so much for the reply and the tut!
@sigilo:disqus I don’t think you missed anything. I think it’s just how that program is designed: it’s meant to make files for use with ponysay https://github.com/erkin/ponys… which is what you’re seeing.
You could try something as simple as
./img2ponysay [whatever] | tr -d '$balon5\\'
or cook up something with grep -EvSorry not much help—never tried to generate art dynamically.
I’ll try grep, thanks for your replies, awesome tutorial on generating the MOTD, congrats!