#!/usr/local/bin/perl $start = `date -d "06-JUL-2008" +%s`; $end = `date -d "21-JUL-2008" +%s`; chop $start; chop $end; $st = scalar localtime $start; $en = scalar localtime $end; print STDERR "Updating wait times from $st to $en\n"; ##$sql = "select * from status where timestamp>='$start' and timestamp<='$end' and status='QUEUED'"; $sql = "select * from status where timestamp>='$start' and timestamp<='$end'"; #print "$sql\n"; #exit(); open(STATUS,"mysql -psjg6898 llq -e \"$sql\" |") || die "Cannot execute mysql command: $!\n"; while ($inline=) { chop $inline; # print "$inline\n"; ($sid,$uid,$t,$s) = split(" ",$inline); $queue_time{$sid}{$uid} = $t; } foreach $key (keys %queue_time) { foreach $k (keys %{$queue_time{$key}}) { $sql2 = "select start from summary where owner='$k' and stepid='$key'"; ($blah,$start) = `mysql -psjg6898 ll_summary -e "$sql2"`; chop $start; if($start!="") { $wait = $start - $queue_time{$key}{$k}; #Granularity of web updates if($wait<600) {$wait=600; } print "update summary set wait_secs=$wait where stepid='$key' and owner='$k';\n"; } } } close(STATUS);