Skip to content

Want Postgres to complete the autovacuum process after importing data from docker-entrypoint.sh #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BalleClorin opened this issue Jun 27, 2019 · 2 comments
Labels
Request Request for image modification or feature

Comments

@BalleClorin
Copy link

Put this before pg_ctl fast stop. May be this part should skipped or run using an environment variable...

echo "Waiting for Postgres autovacuum to start..."

CHECK=$(psql -U postgres link -t -c "select count(pid) from pg_stat_activity where backend_type='autovacuum worker'")

until [ ${CHECK} != 0 ]
do
sleep 15
CHECK=$(psql -U postgres link -t -c "select count(pid) from pg_stat_activity where backend_type='autovacuum worker'")
done

echo "Postgres autovacuum is running... waiting for it to complete.. may take while"

until [ ${CHECK} == 0 ]
do
sleep 15
CHECK=$(psql -U postgres link -t -c "select count(pid) from pg_stat_activity where backend_type='autovacuum worker'")
done

echo "Postgres autovacuum complete. Database can be shut down."

@wglambert wglambert added the Request Request for image modification or feature label Jul 2, 2019
@tianon
Copy link
Member

tianon commented Jul 3, 2019

That code isn't part of our image. If you want that code to run as part of your image, you should be able to drop it into /docker-entrypoint-initdb.d and have it run as you desire. If that's not flexible enough, #496 is going to be your best bet for customizing the entrypoint further.

In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

@tianon tianon closed this as completed Jul 3, 2019
@BalleClorin
Copy link
Author

BalleClorin commented Jul 3, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request Request for image modification or feature
Projects
None yet
Development

No branches or pull requests

3 participants