SAN FRANCISCO (CBS SF) — A homeless man who fell asleep in a dumpster had to be rescued from being crushed after waking up inside a Recology cardboard recycling truck Tuesday morning.

The man was nearly crushed in the garbage truck, but was saved thanks to alert driver Mike Jones, who heard banging coming from the rear of the truck and drove straight to a nearby fire station.

The unidentified man was partially crushed by the truck’s garbage compactor, and crews rescued him just in time.

Officials with Recology said this type of rescue is a rarity. “I’ve worked for this company for 21 years. This is the first time that I’ve ever seen anything like this,” said Recology spokesperson Robert Reed.

He was transported to the hospital with shoulder injuries, but is expected to recover.