X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/bcd2a4a7c5d18d3c95967f9ac3e046260fab7c15..676f7c86705ae9d1ccdfdef6f6574cb491006e63:/utils/cron_logrotate.sh diff --git a/utils/cron_logrotate.sh b/utils/cron_logrotate.sh index 77102d98..7d3ca4a3 100755 --- a/utils/cron_logrotate.sh +++ b/utils/cron_logrotate.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e # # Rotate query logs. @@ -8,13 +8,13 @@ basedir=`dirname $0` logfile=`date "+$basedir/../log/query-%F.log.gz"` # dump the old logfile -pg_dump -a -F p -t backup_query_log $dbname | gzip -9 > $logfile || exit +pg_dump -a -F p -t backup_query_log $dbname | gzip -9 > $logfile # remove the old logs psql -q -d $dbname -c 'DROP TABLE backup_query_log' # rotate -psql -q -1 -d $dbname -c 'ALTER TABLE new_query_log RENAME TO backup_query_log;CREATE TABLE new_query_log as (select * from backup_query_log limit 0);GRANT SELECT, INSERT, UPDATE ON new_query_log TO "www-data"' +psql -q -1 -d $dbname -c 'ALTER TABLE new_query_log RENAME TO backup_query_log;CREATE TABLE new_query_log TABLESPACE ssd2 as (select * from backup_query_log limit 0);GRANT SELECT, INSERT, UPDATE ON new_query_log TO "www-data"' psql -q -d $dbname -c 'ALTER INDEX idx_new_query_log_starttime RENAME TO idx_backup_query_log_starttime' -psql -q -d $dbname -c 'CREATE INDEX idx_new_query_log_starttime ON new_query_log USING BTREE (starttime)' +psql -q -d $dbname -c 'CREATE INDEX idx_new_query_log_starttime ON new_query_log USING BTREE (starttime) TABLESPACE ssd2'