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/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.
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

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.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder