[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

ssh in bash script



Hey, folks.

Here's my bash script:
*********************************

#!/bin/bash

mysqldump -hlocalhost -uusername -ppassword --add-drop-table dbname table1 table2 table3 | ssh -2 username host com mysql -hlocalhost -uusername -ppasword dbname;

echo "mysql -hlocalhost -uusername -ppassword -e\"use dbname; drop table table1; alter table qs9000 rename qs9000_subscribers; create table qs9000 select * from qs9000_subscribers; alter table qs9000 modify id bigint not null auto_increment, add primary key (id), add index (Country,State,ISONum,Version,Reginfo2); SELECT * FROM table1 ORDER BY Add1 ASC\" qsu > '/usr/local/www/filename.txt'; zip -9D '/usr/local/www/filename.zip' '/usr/local/www/filename.txt';" | ssh -2 username host com;

*********************************
It works just fine, however I am forced to enter my ssh password twice. I am wondering if there is a way to do this without having to enter my password multiple times.


The things I've considered but don't have the know-how to implement right now are piping commands differently or reusing the same SSH channel, referring to it with SSH_AUTH_SOCK or something like that.

Thanks a lot for reading.


-Ali







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]