I learned the following from http://www.pjtrix.com/blawg/category/computing/networks/ssh/.
Today, I wondered if there was a way to keep my IM and ssh sessions alive when putting my mac to sleep.
Because my IM connects through an ssh proxy, when I put my laptop to sleep, my ssh session dies, and my IM goes with it. When I wake my mac, I have to proxy through with another ssh session. This gets old when I’m at my desk and need to go to a meeting, etc.
So I installed autossh with macports “sudo port install autossh” and then run this to create an autossh session:
“autossh -M 20000 -t email@example.com -D 1080”. After I enter my password, I have a proxy session for my IM. I launch IM, then put my mac to sleep. When it awakes, everything is working like a charm.