Index: /tools/check-batch-cmd
===================================================================
--- /tools/check-batch-cmd	(revision 10093)
+++ /tools/check-batch-cmd	(revision 10094)
@@ -56,5 +56,5 @@
 def update_hosts(filters=[]):
   for host in gformat.get_hostlist():
-    if filters and not any([f in host for f in filters]):
+    if filters and not any([f.lower() in host.lower() for f in filters]):
       continue
 
@@ -105,13 +105,16 @@
 
 def ubnt_keys(hostname):
-  keys = open('authorized_keys','r').read()
+  keys = open(os.path.join(gformat.NODE_DIR,'global_keys'),'r').read()
   ssh = paramiko.SSHClient()
   ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
   ssh.connect(hostname, username='root', password=SSHPASS,timeout=3)
   cmd = 'test -d .ssh || mkdir .ssh;\
-    echo "%s" > .ssh/authorized_keys && \
+    cat > .ssh/authorized_keys && \
     chmod 0700 .ssh && \
-    chmod 0755 . && cfgmtd -p /etc -w' % keys
+    chmod 0755 . && cfgmtd -p /etc -w'
   stdin, stdout, stderr = ssh.exec_command(cmd)
+  stdin.write(keys)
+  stdin.flush()
+  stdin.channel.shutdown_write()
   stdout = stdout.readlines()
   stderr = stderr.readlines()
@@ -131,5 +134,5 @@
   parser_keys = subparsers.add_parser('keys', help='add ssh keys on UBNT')
   parser_keys.add_argument('host', type=str)
-  parser_snmp.set_defaults(func='keys')
+  parser_keys.set_defaults(func='keys')
 
   parser_update = subparsers.add_parser('update', help='process all UBNT')
