<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Thank you Diaulas, this looks neet</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span>Bet Regards</span></div><div><br></div>  <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Diaulas Castro <diaulas.castro@intersolution.inf.br><br> <b><span style="font-weight:
 bold;">To:</span></b> "rt-users@lists.bestpractical.com" <rt-users@lists.bestpractical.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, 10 May 2013, 21:42<br> <b><span style="font-weight: bold;">Subject:</span></b> [rt-users] RES:  Generate end of the day report and email<br> </font> </div> <div class="y_msg_container"><br><div id="yiv6989585450">

 
 
<style><!--
#yiv6989585450  
 _filtered #yiv6989585450 {font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
 _filtered #yiv6989585450 {font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
 _filtered #yiv6989585450 {font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
#yiv6989585450  
#yiv6989585450 p.yiv6989585450MsoNormal, #yiv6989585450 li.yiv6989585450MsoNormal, #yiv6989585450 div.yiv6989585450MsoNormal
        {margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman", "serif";}
#yiv6989585450 a:link, #yiv6989585450 span.yiv6989585450MsoHyperlink
        {
color:blue;
text-decoration:underline;}
#yiv6989585450 a:visited, #yiv6989585450 span.yiv6989585450MsoHyperlinkFollowed
        {
color:purple;
text-decoration:underline;}
#yiv6989585450 p.yiv6989585450MsoAcetate, #yiv6989585450 li.yiv6989585450MsoAcetate, #yiv6989585450 div.yiv6989585450MsoAcetate
        {

margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma", "sans-serif";}
#yiv6989585450 span.yiv6989585450EstiloDeEmail17
        {
font-family:"Calibri", "sans-serif";
color:#1F497D;}
#yiv6989585450 span.yiv6989585450TextodebaloChar
        {


font-family:"Tahoma", "sans-serif";}
#yiv6989585450 .yiv6989585450MsoChpDefault
        {
font-size:10.0pt;}
 _filtered #yiv6989585450 {
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
#yiv6989585450 div.yiv6989585450WordSection1
        {}
--></style>

<div>
<div class="yiv6989585450WordSection1">
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">Made this bash script to accomplish using RT CLI.</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">Just customize “From:”,  To:” and “Status” search in rt ls command and schedule on crontab.</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">This script will list all tickets and mail fields to temp file after that a while loop will add html tags (tables and rows) trough command sed,
 so I got a nice looking mail report. (http://postimg.org/image/yfmlp9307/)</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  If you want to color the rows use this before sendmail command:</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  sed -i -e '/Nobody/s/D2EAF1/CCCCCC/g'          $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  sed -i -e '/diaulas.castro/s/D2EAF1/6FCCFF/g'   $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;"></span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">    This will change all tickets by nobody to gray and Diaulas.castro to light blue</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">PS: I know! RT-CRONTOOL exist, but I m not perl expert.. =(</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">####################################</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">export RTORDERBY=owner</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">MAIL=/tmp/rel_todos_tickets_abertos.sh.mail</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "From: MY_TICKET@MY_DOMAIN.COM "                > $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "To: DIRECTORS@MYDOMAIN.COM"     >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "MIME-Version: 1.0"                                >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo 'Content-type: text/html; charset=iso-8859-1'      >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo " boundary=`date +%s`/rt.MY.DOMAIN.COM"     >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "Subject: All open Tickets:$(date +%d/%m/%y)"       >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo ""                                                 >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "<html>"                                           >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "<HEAD>"                                           >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "</HEAD>"                                          >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "<BODY>"                                           >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "<span style=\'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D\'>" >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "<table>">>                                        $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">/usr/bin/rt ls "Status != resolved AND Status != report AND Status != plantao AND Status != stalled" -f id,subject,queue,status,owner,lastupdated
 |iconv -f UTF-8 -t ISO8859-1 > /tmp/rel.tmp</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">while read line ; do</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  echo  "<span style='color:#000000'><TR><TD style='background:#D2EAF1;padding:0cm 5.4pt 0cm 5.4pt'>$line</TD></TR></span" | sed "s/    /<TD style='background:#D2EAF1'>/g"</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">done < /tmp/rel.tmp >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "</table>">> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "</BODY>"                                          >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">echo "</html>"                                          >> $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">/usr/sbin/sendmail -t < $MAIL</span></div> 
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div>
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
</div>
<div class="yiv6989585450MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D;">  </span></div> 
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;">
<div class="yiv6989585450MsoNormal"><b><span style="font-size:10.0pt;">De:</span></b><span style="font-size:10.0pt;"> rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com]
<b>Em nome de </b>Asanka Gunasekera<br>
<b>Enviada em:</b> sexta-feira, 10 de maio de 2013 05:48<br>
<b>Para:</b> rt-users@lists.bestpractical.com<br>
<b>Assunto:</b> [rt-users] Generate end of the day report and email</span></div> 
</div>
</div>
<div class="yiv6989585450MsoNormal">  </div> 
<div>
<div>
<div class="yiv6989585450MsoNormal" style="background:white;"><span style="color:black;">Hi, is there any way to auto generate end of the day report and emal this to management (all open, all new etc)</span></div> 
</div>
<div>
<div class="yiv6989585450MsoNormal" style="background:white;"><span style="color:black;">  </span></div> 
</div>
<div>
<div class="yiv6989585450MsoNormal"><span style="color:black;">I am using RT4 and oracle database on redhat</span></div> 
</div>
<div>
<div class="yiv6989585450MsoNormal"><span style="color:black;">  </span></div> 
</div>
<div>
<div class="yiv6989585450MsoNormal"><span style="color:black;">Thanks and Regards</span></div> 
</div>
</div>
</div>
</div>

</div><br><br><br>-- <br>RT Training in Seattle, June 19-20: <a href="http://bestpractical.com/training" target="_blank">http://bestpractical.com/training</a><br><br></div> </div> </div>  </div></body></html>