It was the busiest time of the day at Hartford Distributors, the morning shift change. And among the dozens of warehouse workers, sales representatives and executives inside the sprawling building in Manchester, Conn., was the company’s newest truck driver, about to lose his job.

The driver, Omar S. Thornton, 34, came in at 7 a.m. on Tuesday for a disciplinary hearing. Mr. Thornton had been with the company for two years, still new in a family-run workplace where others had been on the payroll for decades. He had reason to be worried: his bosses said they had video showing him stealing beer from the company. He might also have had cause to be angry: he had complained to his girlfriend of being racially harassed at work, the woman’s mother said, and lamented that his grievances had gone unaddressed.

His bosses gave him a stark choice: resign or be fired. Mr. Thornton, according to the authorities, instead drew a handgun, opened fire and moved through the warehouse as his toll mounted. He shot fellow drivers, a company executive and a local union president, the authorities said.

When he was done, eight people lay fatally shot, two more were wounded, and Mr. Thornton, following the blueprint of so many other mass shootings, had killed himself, the authorities said.