Skip to content

Commit

Permalink
use curly braces around loop variables
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Sep 11, 2024
1 parent 80c5e4f commit 59e1fe2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions postgres-appliance/scripts/post_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,25 @@ fi
# Sunday could be 0 or 7 depending on the format, we just create both
for i in $(seq 0 7); do
if [ "$LOG_SHIP_HOURLY" != true ]; then
echo "CREATE FOREIGN TABLE IF NOT EXISTS public.postgres_log_$i () INHERITS (public.postgres_log) SERVER pglog
OPTIONS (filename '../pg_log/postgresql-$i.csv', format 'csv', header 'false');
GRANT SELECT ON public.postgres_log_$i TO admin;"
echo "CREATE FOREIGN TABLE IF NOT EXISTS public.postgres_log_${i} () INHERITS (public.postgres_log) SERVER pglog
OPTIONS (filename '../pg_log/postgresql-${i}.csv', format 'csv', header 'false');
GRANT SELECT ON public.postgres_log_${i} TO admin;"
else
for h in $(seq 0 23); do
echo "CREATE FOREIGN TABLE IF NOT EXISTS public.postgres_log_$i_$h () INHERITS (public.postgres_log) SERVER pglog
OPTIONS (filename '../pg_log/postgresql-$i-$h.csv', format 'csv', header 'false');
GRANT SELECT ON public.postgres_log_$i_$h TO admin;"
echo "CREATE FOREIGN TABLE IF NOT EXISTS public.postgres_log_${i}_${h} () INHERITS (public.postgres_log) SERVER pglog
OPTIONS (filename '../pg_log/postgresql-${i}-${h}.csv', format 'csv', header 'false');
GRANT SELECT ON public.postgres_log_${i}_${h} TO admin;"
done
fi

echo "
CREATE OR REPLACE VIEW public.failed_authentication_$i WITH (security_barrier) AS
CREATE OR REPLACE VIEW public.failed_authentication_${i} WITH (security_barrier) AS
SELECT *
FROM public.postgres_log_$i
FROM public.postgres_log_${i}
WHERE command_tag = 'authentication'
AND error_severity = 'FATAL';
ALTER VIEW public.failed_authentication_$i OWNER TO postgres;
GRANT SELECT ON TABLE public.failed_authentication_$i TO robot_zmon;
ALTER VIEW public.failed_authentication_${i} OWNER TO postgres;
GRANT SELECT ON TABLE public.failed_authentication_${i} TO robot_zmon;
"
done

Expand Down

0 comments on commit 59e1fe2

Please sign in to comment.