[EMAIL PROTECTED] wrote:
I have exactly the same problem,

UnlockTickets.pl --timeout does not work, however UnlockTickets.pl --all
does work. Does anyone know a workarround for this problem?

I noticed the same problem and fixed it. Try patching it with this patch. (Go into otrs/bin directory and run patch < UnlockTickets.pl.patch)

Then, edit otrs/var/run/cron/unlock to call the script with argument
--timeout-simple instead of --timeout (or further change the script,
I decided to leave original code there and just add my part).

Then run su otrs -c 'bin/Cron.sh start' -- that will fix the crontab
of otrs user and you're ready to roll.

Regs,
D.

--
Damir Dzeko            \\\      <[EMAIL PROTECTED]>
Ouroboros d.o.o.       ///    http://www.ouroboros.hr
  Gunduliceva 63       ///      tel: +385 1 482-89-89
  HR-10000 Zagreb      \\\        fax: +385 1 482-89-79

--- UnlockTickets.pl    2004-04-05 19:14:11.000000000 +0200
+++ UnlockTickets2.pl   2004-11-29 19:43:57.000000000 +0100
@@ -41,7 +41,8 @@
 use Kernel::System::State;
 use Kernel::System::Lock;
 
-my $Debug = 0;
+my $Debug = $ENV{OTRS_DEBUG} || 0;
+$| = 1; # unbuffered output
 
 # --
 # common objects
@@ -199,6 +200,48 @@
     exit (0);
 }
 # --
+# unlock old tickets -- plain and simple way
+# --
+elsif ($Command eq '--timeout-simple') {
+    print " Simple lock timeout:\n";
+    my @Tickets = ();
+    my $time = time();
+    my $SQL =
+      "SELECT st.id, FLOOR(($time - st.timeout) / 60) lock_age, 
sq.unlock_timeout".
+      " FROM ticket as st, queue as sq".
+      " WHERE st.queue_id = sq.id".
+      " AND st.ticket_lock_id NOT IN ( ${\(join ', ', @ViewableLockIDs)} ) ";
+    $CommonObject{DBObject}->Prepare(SQL => $SQL);
+    my $n_locked = 0;
+    my $action = '';
+    while (my @RowTmp = $CommonObject{DBObject}->FetchrowArray()) {
+        ++ $n_locked;
+       if ($RowTmp[1] > $RowTmp[2]) {
+         push (@Tickets, $RowTmp[0]);
+         $action = 'UNLOCK';
+       } else {
+         $action = 'leave';
+       }
+       $Debug and print STDERR "* ticket: $RowTmp[0], lock-age: $RowTmp[1], 
timeout: $RowTmp[2] - $action\n";
+    }
+    my $n_unlock = scalar(@Tickets);
+    print " From $n_locked locked tickets $n_unlock need unlocking.\n";
+    foreach my $id (@Tickets) {
+        print " Unlocking ticket id $id ...";
+        if ($CommonObject{TicketObject}->LockSet(
+            TicketID => $id,
+            Lock => 'unlock',
+            UserID => 1,
+        ) ) { 
+            print " done.\n";
+        }
+        else {
+            print " failed.\n";
+        }
+    }
+    exit (0);
+}
+# --
 # show usage 
 # --
 else {
_______________________________________________
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Support oder Consulting für Ihr OTRS System?
=> http://www.otrs.de/

Reply via email to