*** a/src/backend/postmaster/autovacuum.c
--- b/src/backend/postmaster/autovacuum.c
***************
*** 507,512 **** AutoVacLauncherMain(int argc, char *argv[])
--- 507,516 ----
  		/* Now we can allow interrupts again */
  		RESUME_INTERRUPTS();
  
+ 		/* if in shutdown mode, no need for anything further; just go away */
+ 		if (got_SIGTERM)
+ 			goto shutdown;
+ 
  		/*
  		 * Sleep at least 1 second after any error.  We don't want to be
  		 * filling the error logs as fast as we can.
***************
*** 542,551 **** 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 */
  	}
  
--- 546,559 ----
  	SetConfigOption("default_transaction_isolation", "read committed",
  					PGC_SUSET, PGC_S_OVERRIDE);
  
! 	/*
! 	 * In emergency mode, just start a worker (unless shutdown was requested)
! 	 * and go away.
! 	 */
  	if (!AutoVacuumingActive())
  	{
! 		if (!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;
--- 568,575 ----
  	 */
  	rebuild_database_list(InvalidOid);
  
! 	/* loop until shutdown request */
! 	while (!got_SIGTERM)
  	{
  		struct timeval nap;
  		TimestampTz current_time = 0;
***************
*** 758,763 **** AutoVacLauncherMain(int argc, char *argv[])
--- 767,773 ----
  	}
  
  	/* Normal exit from the autovac launcher is here */
+ shutdown:
  	ereport(LOG,
  			(errmsg("autovacuum launcher shutting down")));
  	AutoVacuumShmem->av_launcherpid = 0;
