#!/bin/sh ###################################################################### # Copyright (C) 2004 Martijn van Oosterhout # # # # This program is free software; you can redistribute it and/or # # modify it under the terms of the GNU General Public License # # as published by the Free Software Foundation; either version # # 2 of the License, or (at your option) any later version. # # # ###################################################################### DAY=`perl -e 'print int(time() / 86400)+1'` psql kleptog -q <= $DAY and daynum < $DAY+7 and channel_id = channels.channel_id); update channels set confirmed = (select float4smaller(1,sum(duration)::float/(7*86400)) from guide_data where daynum >= $DAY and daynum < $DAY+7 and channel_id = channels.channel_id and confirmed); vacuum analyze channels; EOF