remove colorful cli output, cause the escape sequences are sent via mail

too
This commit is contained in:
HF 2023-07-07 10:58:56 +02:00
parent 554dde6257
commit 01c9dc4825

View File

@ -110,7 +110,8 @@ check_rooms () {
amount_local=$(echo "$room" | jq -r .joined_local_members)
id=$(echo "$room" | jq -r .room_id)
server=$(echo "$id" | sed -e 's/[^:]*://')
printf "=> ${L}${id} = ${G}${amount},${amount_local} ${R}${server}${NC}\n"
#printf "=> ${L}${id} = ${G}${amount},${amount_local} ${R}${server}${NC}\n"
printf "=> ${id} = ${amount},${amount_local} ${server}\n"
if [ "${server}" != "${HOMESERVER}" ] && [ "${amount_local}" = "0" ]; then
echo "Room ${id} is federated, but has no local users in it, purging..."
purge_room ${id}
@ -193,7 +194,7 @@ check_api_rooms () {
ROOMS=`psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "select room_id from room_aliases where room_alias like '#${PREFIX}_%'"`
for room in ${ROOMS}
do
echo "=> Delete event_push_actions of not logged-in users from romm ${room} and kick out inactive users..."
echo "=> Delete push_actions of logged-out users from ${room} and kick out inactive users..."
# Clean event_push_actions of not-logged-in application service users
# see https://github.com/matrix-org/synapse/issues/5569
# This command can be really slow, if it takes too long, remove the "not exists..." part and it won't care about if logged in or not
@ -225,14 +226,14 @@ compress_state () {
clean_db () {
echo "--Clean up cache_invalidation_stream_by_instance"
# see https://github.com/matrix-org/synapse/issues/8269
time psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "delete from cache_invalidation_stream_by_instance where to_timestamp(invalidation_ts/1000) > now() - interval '1 months';"
psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "delete from cache_invalidation_stream_by_instance where to_timestamp(invalidation_ts/1000) > now() - interval '1 months';"
echo "--Vaccum..."
time psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "VACUUM FULL"
}
print_stats () {
echo "--DONE. Current database size is..."
time psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "SELECT pg_size_pretty( pg_database_size( 'synapse' ) )"
psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "SELECT pg_size_pretty( pg_database_size( 'synapse' ) )"
[ -n "${BASH_VERSION}" ] && set +H
psql postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "SELECT nspname || '.' || relname AS \"relation\", pg_size_pretty(pg_total_relation_size(c.oid)) AS \"total_size\" FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND c.relkind <> 'i' AND nspname !~ '^pg_toast' ORDER BY pg_total_relation_size(c.oid) DESC LIMIT 20;"
}