RT3 : Automatically assign owner by queue

There is one bit of functionality that I keep reusing for pretty much every installation of RT3 – automatic assignment of tickets to specific users based on queue.  There are a few solutions to this problem and some are documented in RT3 wiki.  But I always keep forgetting which solution to use and where I found it.  So, in hopes not to ever spend more than 3 seconds searching for such a solution, I’m posting it here.

We’ll be using a global scrip instead of a per-queue scrip.  This will simplify maintenance for those installations that use a lot of queues – you’ll need to change settings only in one place rather than all over the place.  Create the new global scrip with the following settings:

  • Description: AutoSetOwnerForQueue
  • Condition: On Create
  • Action: User Defined
  • Template: Global Template : Blank
  • Stage: TransactionCreate
  • Custom condition: return 1;
  • Custom action preparation code: return 1;
  • Custom action cleanup code:
my %owners = (
  'queue_name1' => 'username1',
  'queue_name2' => 'username1',
  'queue_name3' => 'username2',
my $QueueName = $self->TicketObj->QueueObj->Name;
return 1 unless defined($owners{$QueueName});
my $Actor = $self->TransactionObj->Creator;
return 1 if $Actor == $RT::SystemUser->id;
return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;

my $MyUser = $owners{$QueueName};

$RT::Logger->info("Auto assigning ticket #". $self->TicketObj->id ." to user $MyUser" );
my ($status, $msg) = $self->TicketObj->SetOwner( $MyUser );
unless( $status ) {
  $RT::Logger->warning( "Impossible to assign the ticket to $MyUser: $msg" );
return undef;

Last time I’ve used this was on RT 3.8.8. Adjust accordingly for the earlier and later versions.

chmod text modes

I came across this blog post which praises text modes for /bin/chmod.

There are two ways you can change file permissions in Unix – one is using chmod‘s symbolic (text) modes (like chmod ug+x file), the other is using the octal modes (like chmod 0660 file). It turns out that symbolic modes are more powerful because you can mask out the permission bits you want to change! Octal permission modes are absolute and can’t be used to change individual bits. Octal modes are also sometimes called absolute because of that.

I have to agree, they are superior.  However I feel like the article needs more examples.  So here we go.

Use “u” for user, “g” for group, “o” for others, and “a” for all, or you can use a combination of letters, similar to how you do for access rights:

$ chmod ug+rw *.php

This will make all .php files in current directory readable and writable by both user and group.

Use several permission changes within one command.  Just separate them by comma.

$ chmod a-rwx,ug+rw,o+r *.php

The above will reset permissions on all .php files to readable by all and writable only by user and group.

And my favorite and most used example, which would be tricky with octal permissions is the “X”.  In recursive change mode, “X” will affect executable bit only on directories.  Difference by illustration:

$ chmod -R a+x /some/path

The above will add executable bit to all files and folders under /some/path.

$ chmod -R a+X /some/path

But the above will add executable bit only to folders under /some/path.  The files will remain as they are.

Medieval technical support

Yesterday I discovered that the video of medieval tech support might be too old now and that the younger generation of IT guys could have easily missed it.  Here it goes, a piece of classics, for everyone to enjoy.  By the way, you don’t have to work in IT to have a laugh at it.


Shell keyboard shortcuts

I came across a very useful post with the listing of many shell keyboard shortcuts.  The article covers a mix of bash, csh, zsh, and Cisco shell keyboard shortcuts.  The article is in Russian, but I think it will be helpful for more people, so I took the liberty to translate it.  Continue reading for the translation.

Continue reading “Shell keyboard shortcuts”

Appreciate your sysadmin. At least today.

Today is the System Administrator Appreciation Day.  I wish a happy sysadmin day to everyone who ever took their time to answer a stupid question for a billionth time without resolving to violence, to everyone who ever spent a night or a weekend in the office fixing a problem that he didn’t create, to everyone who makes IT infrastructure invisible until there is a problem, to everyone who spent their own free time to make things better for the rest of the world, to everyone who despite working hard and taking a lot of initiative is often the first person to blame, to everyone who spent hours in the freezing datacenters or on pan-frying roofs or in dark and stinky basements, to everyone who’s mobile phone receives dozens of SMS messages every hour 24×7, to everyone who’s mobile number is posted on all office white-boards with the caption “Emergency”, to everyone … you got the idea.

If you know a sysadmin, take a minute of your time, go and say “Thank you”.  If you have some change in your pocket, buy your sysadmin a pint of beer.  If you are a hot girl, go give him a kiss and a hug.  Or her.  If you are not a sysadmin, you don’t have and probably won’t ever have an idea of how hard these people work to make your life easier.  It’s their day today.

If you still don’t understand what sysadmins do, have a look here.

Monitoring tree of Linux processes

Once in a while there is a need to see the tree of processes on a Linux system.  When such a need arises, I usually run “ps auxw –forest“, which results in something like this (partial output, top only):

/bin/ps auxw --forest

Today, via this blog post, I’ve learned that there is another way – “pstree“.  This command accepts a number of parameters, but in its simplest form, results in something like this (partial output, top only):


On my Fedora box, /usr/bin/pstree is a part of the psmisc RPM, which is the one that brings /usr/bin/killall to the system.

On scalability of MySQL

Anyone who says that MySQL is not scalable has no idea.  Facebook is one of the examples for a large deployment of MySQL:

How big is Facebook’s Internet infrastructure? Facebook VP of Technology Jeff Rothschild provided some details in a panel at the recent MySQL user conference. Rothschild says Facebook is now running 10,000 servers, including 1,800 MySQL servers that are overseen by just two database administrators.

Facebook recently surpassed 500,000,000 users – half a billion!

Integrating RT3 with Subversion

As I have mentioned a few times before, I am a big fan of using BestPractical RT3 for all sorts of things, including, but not limited to, bug tracking during project development.  I see a great benefit in having a single system for both technical support and development departments.  Bugs can be reported by customers, investigated by technical support department, passed on to developers, fixed and tested, and then passed back to technical support department to verify with the customer and resolve.

Needless to say, integrating RT3 with Subversion can be of great benefit.  In this case, not only you will have full history of bug reports, but you’ll also see which code changes were made for each bug report.  Learning from previous bug fixes and having a quick way to see why something was changed is priceless.

Read more to see how RT3 can be integrated with Subversion.  You can also easily adopt the same approach to other version control systems.

Continue reading “Integrating RT3 with Subversion”