[Ssh-sftp-perl-users] Socket closing issue
Brought to you by:
dbrobins
From: Michael G. <mic...@bl...> - 2006-03-16 04:32:12
|
Hello, I have a perl script the runs like a daemon process, once started it does not exit unless sent a kill signal. It is used to monitor a log file. In this script I have a sub with the following code: --snip-- my $ssh2 = Net::SSH2->new; &contact_error("Unable to connect to server") unless $ssh2->connect($settings->get('filter.host')); &contact_error("Unable to authenticate") unless $ssh2->auth_password($settings->get('filter.user'),$settings->get('filter.pass')); my $chan = $ssh2->channel; $chan->exec('sudo run some command') or $rtn=1; my $chan_rtn = $chan->exit_status; &dlogging("$chan_rtn"); $chan->close(); $ssh2->disconnect('byebye'); --snip-- Now this all work fine except a netstat shows the connection still open and it is stuck in a CLOSE_WAIT state. It will never exit this stat, untill I kill the process and then they will slowly turn to a LASK_ACK stat and then the connection will be removed. What am I doing wrong that this connection is being left open ? Thanks Michael Gale |