bash script with permanent ssh connection

Posted by samuelf on Server Fault See other posts from Server Fault or by samuelf
Published on 2010-07-12T23:49:15Z Indexed on 2011/01/15 16:55 UTC
Read the original article Hit count: 360

Filed under:
|
|
|
|

Hi, I use a bash script which runs

/usr/bin/ssh -f -N -T -L8888:127.0.0.1:3306 [email protected]

However, when I run the bash script, it waits.. I see the connection coming up but the script doesn't exit.. it's like it's waiting for the SSH process to finish, because when I manually kill it the bash script finishes as well.

Any ideas how to resolve this?

UPDATE: I have croned this script.. and the cron process is the one that becomes a zombie.. the actual scripts runs just fine, sorry about that, with ps -auxf I get:

root       597  0.0  0.7   2372   912 ?        Ss   Jul12   0:00 cron
root      2595  0.0  0.8   2552  1064 ?        S    02:09   0:00  \_ CRON
1001      2597  0.0  0.0      0     0 ?        Zs   02:09   0:00      \_ [sh] <defunct>
1001      2603  0.0  0.0      0     0 ?        Z    02:09   0:00      \_ [cron] <defunct>

and when I kill the ssh the defuncts disappear.. why would they become defunct?

© Server Fault or respective owner

Related posts about linux

Related posts about ubuntu