bash script with permanent ssh connection
- by samuelf
Hi, I use a bash script which runs
/usr/bin/ssh -f -N -T -L8888:127.0.0.1:3306 [email protected].23
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?