SSH Tunnel help - how to auto restart on wake?

Discussion in 'iPod touch' started by mixersoft, Jun 3, 2010.

  1. mixersoft

    mixersoft New Member

    Joined:
    Jun 3, 2010
    Messages:
    2
    Likes Received:
    0
    I've got a 2G Touch with SSH Tunnels working fine using this command:

    Code:
    ssh -fNCq -i ~/.ssh/id_dsa -l username -L 8080:remotehost:8080 remotehost
    The problem is that the connection dies on sleep. I have to go into the terminal to restart it after every wakeup.

    I have a script to restart, but even that requires me to type my password to run.

    Code:
    if sudo ps axo pid,command | grep remotehost | grep ssh
    then
         echo RUNNING
         PID=`sudo ps axo pid,command | grep remotehost  | grep ssh | grep -oG ^[0-9]*`
         echo killing pid=$PID
         sudo kill -9 $PID
    fi
    ssh -fNCq -i ~/.ssh/id_dsa -l username -L 8080:remotehost:8080 remotehost
    sudo ps axo pid,command | grep proxy.snaphappi | grep ssh
    

    Is there an app to make it easy to clean up dead SSH processes and restart - or a better way to do SSH Tunnels?
  2. iDaMan

    iDaMan New Member

    Joined:
    Jun 2, 2010
    Messages:
    9
    Likes Received:
    0
    Device:
    3G iPod touch
    Get on your iPod. Go to Settings > General, and there should be some option that is set at either 1, 2, 3, 4, or 5 minutes. Touch that option, and change it to "Never". This means that your iPod will never go into sleep mode.
  3. mixersoft

    mixersoft New Member

    Joined:
    Jun 3, 2010
    Messages:
    2
    Likes Received:
    0
    Sleep is a good thing. Saves battery life. I need to be able to wake gracefully.

Share This Page