The Long Island Rail Road inched perilously close to a full shutdown on Friday as five unions prepared to go on strike if they don't reach a deal with the MTA by midnight.

The deadline was the culmination of months of negotiations that included several interventions by an emergency board set up by President Donald Trump. But as of Friday morning, unions representing a majority of the LIRR’s workers still had not agreed to new contracts with the transit agency.

The standoff set the stage for the first labor shutdown of the LIRR since 1994. The service carries more than 275,000 riders each weekday, making it the busiest commuter railroad in the country.

Speaking after failed discussions Thursday night, MTA labor lawyer Gary Dellaverson said it had been a long and “ relatively frustrating day” of negotiating. The two sides were back at the table Friday as the midnight deadline loomed.

The bargaining hang-up surrounded the final year of the contract. The unions are asking for a 5% raise in the final year of the deal. MTA officials countered with a smaller raise, but offered a one-time $3,000 lump-sum payout they said was the equivalent to a 5% bump, which the union refused.

“It's just money, and this dispute has been about money,” Dellaverson said Thursday.

Dellaverson’s tone Thursday night was less optimistic than the one he struck a day earlier, when he said “it is in everybody's interest to not run this down to the last minute.”

The MTA was in another contract negotiation Friday, as the agency’s agreement expired with Transport Workers Union Local 100, which represents 38,000 subway and bus workers. Unlike the LIRR workers, the city transit union is forbidden by state law from going on strike.

Last year, NJ Transit workers went on a three-day strike before coming to an agreement on a Sunday. Riders only suffered one-weekday shutdown during that walkout.

While the MTA is ready to deploy an extensive shuttle plan service for getting many commuters in and out of the city, the agency admits it is not enough to completely replicate train service. Gov. Kathy Hochul asked LIRR commuters to stay home during a potential strike, if possible.

The MTA reported it has prepared 275 buses to move LIRR riders to subway stations every 10 minutes during the morning and evening commutes.

If the strike goes down, MTA officials said buses will run from Hempstead Lake State Park, Hicksville, and Mineola LIRR stations and take riders to the JFK-Howard Beach stop on the A train. Shuttle buses from Huntington and Ronkonkoma stations will bring commuters to the Jamaica-179th Street stop on the F line, the MTA said.

The MTA estimated the shuttle buses would cost $550,000 a day to run — far cheaper than the railroad.