     }
 
     match_max 2000
-  } 
+
+  } else {
+
+    if { $mode == "update" } {
+      expect timeout {
+        send_user "connection timeout\n"
+        close
+        continue
+      } eof {
+        send_user "connection interrupted\n"
+        continue
+      } "*-> " {
+        send -s "exec av scan-mgr pattern-update\r"
+      }
+    }
+  }
 
   expect timeout {
     send_user "connection timeout\n"

;# default username and password
set username "netscreen"
set password "netscreen"

if { $argc < 1 } {
  puts "\nUsage: $argv0 hosts_list_file.txt <password> <username>\n"
  exit
} 

if { $argc > 1 } {
  set password [lindex $argv 1]
  if { $argc > 2 } {
    set username [lindex $argv 2]
  }
}



set filelist [lindex $argv 0]
set fp [open $filelist r]
while { [gets $fp host] >= 0 } {

  send_user "\[+\] $host - "

