It is currently Sat May 26, 2018 8:07 am

Passphrase entrance

All times are UTC - 6 hours

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Tue Jan 26, 2010 5:22 pm   

Joined: Tue Jan 26, 2010 5:07 pm
Posts: 1
Hi all,
I'm pretty new at scripting and and just have done some simple scripts - so my hope is that someone of you is able to help me.

We have a program running, which does include database, but also a "Zone" and kind of a Certificate. The Backup of the database is not a problem, but the Certificate and the Zone. When I backup those, it asks for a passphrase to enter. It works manually, but I would like to do that with a script.
When I enter the backup command, it takes sometimes 3, sometimes 5 seconds until it asks for the passphrase.
Is there any way to give the passphrase in the script?
Any help and suggestions appreciated,

 PostPosted: Tue Jan 26, 2010 7:21 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 643
Hi tunix,


' would use expect which is not a bash matter.

 PostPosted: Thu Jan 28, 2010 2:22 am   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
You can always try to pass it via STDIN, but most programs does not allow this.

For example, the STDIN directional syntax is the "<<<" part.
mysql -uroot -p database <<< "SELECT * FROM tblname;"

MySQL takes from STDIN and passes it as a command on the prompt. I've seen applications which can do this with password requests also.
For example, if $password is set to "123qwe":
yourapplication-binary <<< "$password"

If this doesn't work then I'd recommend to use Expect, but that is not a bash issue.

Best regards
Fredrik Eriksson

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 8 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group