#!/bin/sh skip_fillrate=90 skip_size=104857600 pg_repack=/usr/lib/postgresql/9.6/bin/pg_repack pgsql() { psql -d "$1" -Aqt < $skip_size;"` if [ -n "$size" ] ; then echo "$database: repack table $table" $pg_repack -d "$database" -t "$table" fi done echo "$database: vacuum and analyze" pgsql "$database" " VACUUM ANALYZE;" done