Automatic ticket unlocking in OTRS and Znuny 6.x

Written by - 0 comments

Published on - last updated on December 19th 2022 - Listed in OTRS

Unlocking tickets in OTRS can help a lot if you work with multiple agents. One agent might have already responded to a ticket and this ticket was then locked on that agent. But what if another agent wants to jump in but cannot respond due to the ticket lock?

In older OTRS versions, the $HOME/bin/ script was used to handle this problem. It could be launched (as otrs user) as a regular cron task. But if you've upgraded to a more recent OTRS version, this script is gone.

Instead commands need to be executed via the OTRS Daemon now. To be able to talk to the OTRS Daemon, the command $HOME/bin/ is used. By simply executing this command (again: as otrs user!), a list of available commands is showing up. And here we're able to find the needed UnlockTicket (single ticket unlock) or UnlockAll subcommands:

$ bin/ | grep -i unlock
 Admin::Config::UnlockAll                 - Unlock all settings.
 Maint::Ticket::InvalidUserCleanup        - Delete ticket/article seen flags and ticket watcher entries of users which have been invalid for more than a month, and unlocks tickets by invalid agents immedately.
 Maint::Ticket::UnlockAll                 - Unlock all tickets by force.
 Maint::Ticket::UnlockTicket              - Unlock a single ticket by force.
 Maint::Ticket::UnlockTimeout             - Unlock tickets that are past their unlock timeout.

A manual run shows on which tickets the command had an effect (= unlocking ticket):

$ bin/ Maint::Ticket::UnlockAll
Unlocking all tickets...
 Unlocking ticket id 106058... done.
 Unlocking ticket id 106061... done.

This command can now be launched periodically by a cron task:

$ crontab -l | grep -i unlock
# Auto unlock tickets
*/15 * * * * $HOME/bin/ Maint::Ticket::UnlockAll > /dev/null

The same also works on the ((OTRS)) Community Edition fork Znuny, by the way.

Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.