He went from serving as commanding NYPD officer at Ground Zero’s infamous “Pile” to a second career serving pies as owner of the famous Bleecker Street Pizza.

But his 9/11 lung disease became too painful to bear, and on Tuesday night, retired Capt. Douglas Greenwood shot himself to death at a park near his Suffolk County home.

“He talked about shooting himself as an inevitable thing,” said a longtime friend, NYC photographer Kevin McCormick.

“He said, ‘When there’s no more quality of life, I’m going to do it,’” McCormick said.

“He knew it was coming.”

Greenwood, 61, of Greenlawn, NY, shot himself in the chest at the entrance to Greenlawn Park.

He’d been co-owner of the highly touted Greenwich Village pizzeria since retiring from the NYPD on 9/11 disability 14 years ago.

Bleecker Street Pizza was a perennial entry on top-NYC-pizza lists.

“As true to my Italian grandmother’s recipe as possible,” Greenwood once said of his Tuscan-style, “Nonna Maria” pie, which features fresh basil and costly Parmigiano-Reggiano cheese.

The dedicated cop had worked 40 days straight on The Pile as captain of the Manhattan South Task Force.

“He was in charge of all the NYPD boots on the ground,” recalled Ralph Friedman, an author, TV personality and retired detective who was Greenwood’s pal for 25 years.

“He’d be commanding the scene, but he also did grunt work — everybody pitched in. Everyone was sifting through the scene for bodies, body parts,” Friedman said.

“He could have stayed in a car. But he was right there. And it cost him his health — as it did for a lot of officers,” he added.

“They did very heroic work — there’s no way around it. And he was right there.”

Practically nobody wore masks on The Pile, including Greenwood.

“Because he was in a position of being in charge, he couldn’t keep his mask on, really, because he was always on the radio,” said McCormick.

For the last 10 years, Greenwood slept with an oxygen tank, and despite multiple surgeries and procedures, he “struggled all the time,” Friedman said. “It was constant, increasing pain. It hurt to breathe. He would never do something like this unless he had no choice. And he had no choice.”

Greenwood was hugely proud of his pizzeria, his pals said — and sometimes would sit and eat in the dining area, pretending to be a customer so he could overhear what people said about his pies.

“Sometimes he’d ask them, ‘How do you like the pizza?’ and they’d rave about it,” McCormick remembered.

“And then he’d say, ‘Well, I’m actually the owner!’”

McCormick summed up Greenwood this way: “Smart, funny and not a bad bone in his body.”

Greenwood served 26 years in the NYPD, said his older brother, Gregory, of Queens, and he’d never have left the department if not for the 9/11 lung damage.

But once retired, he threw himself into his new career.

“He had a whole second life,” his brother said.

“All I can tell you is that he’s very well known in the police world and the pizza world,” he added.

Along the way, Greenwood never married or had kids.

“Nope,” said the brother.

“He was married to the NYPD and pizza.”

Additional reporting by Kevin Fasick and Shawn Cohen