[rt-users] rt v. rt-crontool

Bart bart at pleh.info
Wed Nov 23 14:36:57 EST 2011


Hi,

I believe that the real difference is that the RT tool allows you to
actually create tickets and the RT-CronTool only has the ability to edit
them.

Other then that I wouldn't know much about the differences (except for the
syntax of course).

As for using the RT tool for cron, I can't see a reason for not using it in
cron. (both RT tool and RT-CronTool have their use I guess)

We're using the RT tool in cron for creating periodic tickets (example
below):


#!/bin/bash

/opt/rt4/bin/rt create -t ticket \
set subject='A ticket subject, something snappy' \
set owner=who.should.be.the.owner at example.com \
set requestor=who.should.be.the.requestor at example.com \
set queue='Queue Name' \
set text='More detailed text regarding the periodic action.' \
set CF-'Ticket Type'='Change' \
set CF-'Ticket Priority'='4' \
set CF-'Item A'='Server' \
set CF-'Item B'='Admin' \
set CF-'Item C'='Update'

It's nothing fancy but it's a straight forward way for creating tickets :-)


-- Bart


Op 23 november 2011 20:06 schreef Yan Seiner <yan at seiner.com> het volgende:

> The recent discussion on modifying custom fields got me thinking.... What
> is the difference between using rt and rt-crontool?
>
> Seems that both can do slightly different things and are really different
> tools.  The name makes it seem like rt-crontool is somehow preferred when
> running a scheduled job, but I can't think of a reason why rt could not be
> used in a cron job.
>
> Here's a script I use to create a linked ticket from an email:
>
> #!/bin/bash
>
> # exim helper script for adding an invoice ticket to a work order
>
> # create a temp file and dump stdio into it
> t=$(tempfile --directory=/tmp) || exit 1
> cat - > $t
>
> # we create the ticket
> subject=$(grep -i '^subject:' $t | sed -e 's/^.*: *//')
> ticket=$(/opt/rt4/bin/rt create -t ticket set queue="Water Invoices"
> subject="${subject}" | sed -e s/[^0-9]//g)
> parent=$(/opt/rt4/bin/rt ls -i "'CF.{Work Order No.}'=${LOCAL_PART} and
> queue!='Water Invoices'" | sed -e s+^.*/++)
>
> # validate $parent here; exit 1 if not found
> if [[ -z $parent ]] ; then
>    echo "Work Order ${LOCAL_PART} not found"
>    exit 1
> fi
>
> # exit 1 if multiple tickets found
> if [ `echo $parent | wc | awk '{print $2}'` -gt 1 ] ; then
>    echo "Multiple tickets with Work Order ${LOCAL_PART} found"
>    echo "ticket numbers are " `echo $parent | sed s+ticket/++g`
>    exit 1
> fi
>
> # Now link ticket
> /opt/rt4/bin/rt link ${ticket} memberof ${parent}
>
> # and set custom fields
> /opt/rt4/bin/rt edit ticket/${ticket} set 'CF.{contractor}'="${contractor}"
> /opt/rt4/bin/rt edit ticket/${ticket} set 'CF.{amount}'="${amount}"
>
> export EXTENSION=${ticket}
> cat $t | /opt/rt4/bin/rt-mailgate --action comment --queue Invoices
> --extension ticket --url http://rt.subutil.com
>
>
> --
> Pain is temporary. It may last a minute, or an hour, or a day, or a year,
> but eventually it will subside and something else will take its place. If
> I quit, however, it lasts forever.
>
> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  Barcelona, Spain  November 28 & 29, 2011
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111123/2c03017d/attachment.htm>


More information about the rt-users mailing list