Of course we cannot always share details about our work with customers, but nevertheless it is nice to show our achievements and share some solutions.
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/UnlockTickets.pl 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/otrs.Console.pl 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/otrs.Console.pl | 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/otrs.Console.pl 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/otrs.Console.pl Maint::Ticket::UnlockAll > /dev/null