*** a/src/backend/postmaster/autovacuum.c
--- b/src/backend/postmaster/autovacuum.c
***************
*** 481,486 **** AutoVacLauncherMain(int argc, char *argv[])
--- 481,493 ----
  		/* Report the error to the server log */
  		EmitErrorReport();
  
+ 		/* if in shutdown mode, no need for anything further */
+ 		if (got_SIGTERM)
+ 		{
+ 			RESUME_INTERRUPTS();
+ 			goto shutdown;
+ 		}
+ 
  		/* Abort the current transaction in order to recover */
  		AbortCurrentTransaction();
  
***************
*** 542,549 **** AutoVacLauncherMain(int argc, char *argv[])
  	SetConfigOption("default_transaction_isolation", "read committed",
  					PGC_SUSET, PGC_S_OVERRIDE);
  
! 	/* in emergency mode, just start a worker and go away */
! 	if (!AutoVacuumingActive())
  	{
  		do_start_worker();
  		proc_exit(0);			/* done */
--- 549,559 ----
  	SetConfigOption("default_transaction_isolation", "read committed",
  					PGC_SUSET, PGC_S_OVERRIDE);
  
! 	/*
! 	 * in emergency mode, just start a worker and go away -- unless
! 	 * shutdown was requested.
! 	 */
! 	if (!AutoVacuumingActive() && !got_SIGTERM)
  	{
  		do_start_worker();
  		proc_exit(0);			/* done */
***************
*** 560,566 **** AutoVacLauncherMain(int argc, char *argv[])
  	 */
  	rebuild_database_list(InvalidOid);
  
! 	for (;;)
  	{
  		struct timeval nap;
  		TimestampTz current_time = 0;
--- 570,576 ----
  	 */
  	rebuild_database_list(InvalidOid);
  
! 	while (!got_SIGTERM)
  	{
  		struct timeval nap;
  		TimestampTz current_time = 0;
***************
*** 758,763 **** AutoVacLauncherMain(int argc, char *argv[])
--- 768,774 ----
  	}
  
  	/* Normal exit from the autovac launcher is here */
+ shutdown:
  	ereport(LOG,
  			(errmsg("autovacuum launcher shutting down")));
  	AutoVacuumShmem->av_launcherpid = 0;
