[wplug] cron job whose action is promted?

Patrick Wagstrom pwagstro at andrew.cmu.edu
Mon Nov 15 08:23:26 EST 2004


There are a couple of easy ways you might be able to accomplish this. 
If a program accepts the password on standard input, then you can just
do something like this:

echo PASSWORD | someprogram

and that will send the password to the program, but only if the only
thing someprogram prompts for is the password.

Another solution is to look at popen (or popen2, popen3, popen5) from
Python.  This lets you handle input and output streams from a process as
though they were a file.  I've had good luck using that automate
programs before.

Finally, if you're really a masochist, there is an old program called
expect that will probably suit your needs.  O'Reilly once published a
book on it too.

--Patrick

On Mon, 2004-11-15 at 07:35, Russ Schneider wrote:
> On Sun, 14 Nov 2004, Bill Moran wrote:
> 
> > mysqldump has a --password= switch that allows you to provide the
> > password on the command line ... no prompting.
> 
> Yeah, everyone's answering me about different mysql processes.  While 
> these are cool, I really was interested in the answer in broader terms.
> 
> I really would like to know how to handle being prompted for something 
> like a password from a cron job.



More information about the wplug mailing list