         sql_connect: sql_connect
         sql: sql
     )
-    
+
+    
+    cmd = exports.add_ssh_connect config, cmd if config.ssh_host?
+
+    console.log "tables to dump cmd \n" + cmd
+
     # Make sure you strip the new line chars
     tables_to_dump = shell.exec(cmd,
       silent: true
-    ).output.replace(/(\r\n|\n|\r)/g, "")
+    ).output
+
+    console.log "tables_to_dump\n" + tables_to_dump
+
+    tables_to_dump.replace(/(\r\n|\n|\r)/g, "")
     tables_to_dump.split " "
 
   
   # Run the mysqldump cmd and append the table names from exports.tables_to_dump() fn
   exports.prefixed_sqldump = (config, tables_to_dump) ->
     return false  unless tables_to_dump
-    cmd = exports.mysqldump_cmd(config)
-    cmd += " " + tables_to_dump.join(" ")
-    dump_output = shell.exec(cmd,
-      silent: true
-    ).output
-    dump_output
-
-  
+    cmd = exports.mysqldump_cmd(config) + " " + tables_to_dump.join(" ")
+
+    if typeof config.ssh_host is "undefined"
+      grunt.log.oklns "Creating prefixed DUMP of local database [" + config.database + "/" + config.table_prefix + "]"
+    else
+      grunt.log.oklns "Creating prefixed DUMP of remote database [" + config.database + "/" + config.table_prefix + "]"
+      # tpl_ssh = grunt.template.process(tpls.ssh,
+      #   data:
+      #     host: config.ssh_host
+      # )
+      # cmd = tpl_ssh + " \"" + cmd + "\""
+
+    console.log "prefixed sqldump cmd\n" + cmd
+    cmd
+  
+  exports.add_ssh_connect = ( config, cmd ) ->
+    tpl_ssh = grunt.template.process(tpls.ssh,
+      data:
+        host: config.ssh_host
+    )
+    cmd = tpl_ssh + " " + cmd
+    console.log cmd, 'add ssh connect'
+    cmd
+
   #==========  Caliper mods  ==========
+
+
   exports.db_import = (config, src) ->
     shell.exec exports.mysql_cmd(config, src)
     grunt.log.oklns "Database imported succesfully"

        user: config.user
        pass: config.pass
        database: config.database
    )
    tables_sql = grunt.template.process(prefix_match_tpls.sql,
      data:

    backup_path: "<%= backups_dir %>/<%= env %>/<%= date %>/<%= time %>"
    mysqldump: "mysqldump -h <%= host %> -u<%= user %> -p<%= pass %> <%= database %>"
    mysql: "mysql -h <%= host %> -u <%= user %> -p<%= pass %> <%= database %>"
    sql_connect: "mysql -h <%= host %> <%= database %> -u <%= user %> --password=<%= pass %>"
    rsync_push: "rsync <%= rsync_args %> --delete -e 'ssh <%= ssh_host %>' <%= exclusions %> <%= from %> :<%= to %>"
    rsync_pull: "rsync <%= rsync_args %> -e 'ssh <%= ssh_host %>' <%= exclusions %> :<%= from %> <%= to %>"
    ssh: "ssh <%= host %>"
