Humorous/entertaining MOTD

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

Post Reply
gears
OTRS newbie
Posts: 37
Joined: 24 Feb 2011, 18:29
OTRS Version?: 5.0.14

Humorous/entertaining MOTD

Post by gears » 24 Mar 2011, 21:46

Setup used: OTRS 3.0.6 / Debian 6.0 / Apache 2.2
I'm sure there are other better ways to get the same result, but this is the method I devised with my limited knowledge. Another method could be to actually have it load anew with each page refresh. Keep in mind my MOTD is just to provide internal agents with a source of light entertainment rather than anything informative.
:D

default contents of /opt/otrs/Kernel/Output/HTML/Standard/Motd.dtl:

Code: Select all

<div class="WidgetSimple" id="MessageOfTheDayBox">
    <div class="Header">
        <h2 class="Center">$Text{"Message of the Day"}</h2>
    </div>
    <div class="Content">
        <p>This is the message of the day. You can edit this in Kernel/Output/HTML/Standard/Motd.dtl.</p>
    </div>
</div>
Prerequisites:
fortune: http://en.wikipedia.org/wiki/Fortune_%28Unix%29
cron: http://en.wikipedia.org/wiki/Cron

apt-get install fortune (this applies to Debian. see documentation for your particular distro for how to install)
touch otrsmotd
chmod 755 otrsmod

with your favorite text editor put the following into this file:

Code: Select all

echo "<div class="WidgetSimple" id="MessageOfTheDayBox"> <div class="Header"> <h2 class="Center">$Text{"Message of the Day"}</h2></div><div class="Content"><p>$(/usr/games/fortune -a -e)</p> </div></div>" > /opt/otrs/Kernel/Output/HTML/Standard/Motd.dtl
note: what this is doing is simply overwriting the existing motd file with identical contents plus the output of the fortune command inserted. read the man page for fortune to decide for yourself what options you wish to use. I chose "-a -e" but there are plenty of other choices.
mv otrsmotd /opt/otrs/bin/ - this is the dir i chose. where you place the file is up to you just as long as the crontab below matches up.
cron -e - this will drop you into the crontab editor. add the following line and hit ctrl-x once finished

Code: Select all

*/1 * * * * /opt/otrs/bin/otrsmotd
note: this will load a new MOTD once per minute. change to suit your purposes. if you want this displayed also at the agent login page, enable that option at admin >> sysconfig >> framework >> Agent:frontend >> ShowMotd
OTRS 5.0.14 / Debian 7.11 x64 / Apache 2.2.22 / MySQL 14.14 Distrib 5.5.53

gears
OTRS newbie
Posts: 37
Joined: 24 Feb 2011, 18:29
OTRS Version?: 5.0.14

Re: Humorous/entertaining MOTD

Post by gears » 03 Dec 2016, 02:55

updated for 5.0 -

Code: Select all

echo "<div class="WidgetSimple" id="MessageOfTheDayBox">  <div class="Header">  <h2 class="Center">[% Translate("Message of the Day") | html %]</h2>    </div>   <div class="Content"> <p>$(/usr/games/fortune -a -e)</p>  </div> </div>" > /opt/otrs/Kernel/Output/HTML/Templates/Standard/Motd.tt
also will note Framework → Frontend::Agent::Dashboard DashboardBackend###0420-CmdOutput might be able to achieve the same result in a more elegant way but I was not able to get that working.
OTRS 5.0.14 / Debian 7.11 x64 / Apache 2.2.22 / MySQL 14.14 Distrib 5.5.53

wurzel
OTRS guru
Posts: 2493
Joined: 08 Jul 2010, 22:25
OTRS Version?: 6.0.x

Re: Humorous/entertaining MOTD

Post by wurzel » 18 Dec 2016, 23:49

Hi,

very nice ;) some additional ASCII arts... only works in desktop mode (not mobile mode)

Code: Select all

echo "<div class="WidgetSimple" id="MessageOfTheDayBox">  <div class="Header">  <h2 class="Center">[% Translate("Message of the Day") | html %]</h2>    </div>   <div class="Content"> <p style="font-family:Courier New">$(/usr/games/fortune de)</p>  
<pre class="cow" style="font-family:Courier New">
  -----------------------
         \   ^__^ 
          \  (oo)\_______
             (__)\       )\/\
                 ||----w |
                 ||     ||
</pre>
</div> </div>" > /opt/otrs/Kernel/Output/HTML/Templates/Standard/Motd.tt
    ((OTRS)) Community Edition 6.0.x, LAMP LIVE auf Debian 9
    OTRS 6 Managed Silver

    -- Ich beantworte keine Forums-Fragen PN - No PN please

    I won't answer to unfriendly users any more. A greeting and regards are just polite.

    Post Reply