× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Then, something like this might work:

#!/bin/sh

build_script() {

cat <<End-of-message
#!/usr/local/bin/expect -f
spawn /QOpenSys/usr/bin/gpg
expect {
default {exit 2}
"Enter passphrase:"
}
send "${PASSPHRASE}\n"
}

build_script | /usr/local/bin/expect -f -


You will need to adjust the spawn command for the location of gpg on your
system.

You may need to expand the script, depending on what gpg prompts for, as well.

John McKee



Quoting "Burke, Joel" <jburke@xxxxxxxxxxxxxxxxxx>:

GPG displays "Enter passphrase: "

On Wed, May 27, 2009 at 11:08 AM, John McKee <jmmckee@xxxxxxxxxxxxxx> wrote:

I just read a little closer. Not sure if this works:

echo {$PASSPHRASE} | gpg (Assume the passphrase can come from stdin)

You might also need to use an expect script to get the password into gpg.
Not
sure as I have not used that command. Try the simple echo first. If that
doesn't work, what string does gpg display when it requests the pass
phrase?

John McKee


Quoting "Burke, Joel" <jburke@xxxxxxxxxxxxxxxxxx>:

> Thanks John. Your post was very informative.
>
> I do have one question. After i set an environment variable with the
> passphrase, how do i use it with the gpg command?
>
> On Fri, May 22, 2009 at 11:48 AM, John McKee <jmmckee@xxxxxxxxxxxxxx>
wrote:
>
>> Scott Klement wrote a few fine articles on QSH. And, he helped me get
>> my batch
>> functions working.
>>
>> You could possibly run everything from inside QSH.
>>
>> For example: QSH CMD('somescript')
>>
>> You would either have to provide an absolute path to somescript, such as
>> .home/programmer/somescript, or put the script in a directory that is on
>> QSH
>> search path.
>>
>> Before you invoke QSH, set an environment variable with the passphrase
>> you need
>> for encryption.
>>
>> The script would then contain all the PASE commands.
>>
>> You will also need to add an environment variable to change QSH error
>> messages
>> from completion to escape messages.
>>
>> ADDENVVAR ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) VALUE(Y) +
>> REPLACE(*YES)
>>
>> After the QSH command, MONMSG for QSH0005 QSH0006 QSH0007. This is an
>> example,
>> in the proper sequence:
>>
>>
>> ADDENVVAR ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) VALUE(Y) +
>> REPLACE(*YES)
>> TOMSGQ(*SYSOPR)
>> CHGVAR VAR(&FTPFAIL) VALUE('N')
>> QSH CMD('/QOpenSys/usr/bin/sftp -b +
>> /usr/local/bin/xxx.scr +
>> user@xxxxxxxxxxx ')
>> MONMSG MSGID(QSH0005 QSH0006 QSH0007) EXEC(DO)
>> CHGVAR VAR(&FTPFAIL) VALUE('Y')
>> CHGVAR VAR(&MSGTXT) VALUE('SPBAHCCL - Data could +
>> not be sent to AHC')
>> SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
>> MSGDTA(&MSGTXT) TOMSGQ(*SYSOPR)
>> ENDDO
>>
>> In the above example, I only run sftp. In your case, you would run a
>> script
>> that contained the sftp command. You would still need the -b option to
>> run the
>> sftp in a batch.
>>
>> Notice that I set FTPFAIL to 'N' prior to QSH? This way, if I do not
>> receive
>> one of the messages, I know it was successful.. QSH0005 is sent as a
>> completion
>> message except when there was a failure.
>>
>>
>> HTH
>>
>> John McKee
>>
>> Quoting "Burke, Joel" <jburke@xxxxxxxxxxxxxxxxxx>:
>>
>> > I currently have gzip, gpg and scp up and running in the PASE
environment
>> on
>> > the i5. Obviously, I use these tools to compress, encrypt and then
send a
>> > file to a vendor. They work great when i run the command
interactively
>> in
>> > putty.
>> >
>> > Now, i need to automate this process to run in batch and i am looking
for
>> > some guidance on how to do this task. I know that i can run QP2SHELL
>> > commands in CL. I have successfully gzipped a file in batch but i have
>> yet
>> > to encrypt one. The encryption may be a little trickier(i.e.
>> passphrase).
>> >
>> > Would it be better to write a shell script and just call that through
>> > QP2SHELL in CL or should i call each command separately through CL?
What
>> > would be the best way to monitor for errors or successful completion?
>> >
>> > TIA
>> >
>> > --
>> > Joel Burke
>> > Programmer/Analyst
>> > MARYWOOD UNIVERSITY
>> > 2300 Adams Ave.
>> > Scranton, PA 18509
>> > (570)348-6211
>> >
>> > This message contains confidential information and is intended only
for
>> the
>> > individual named. If you are not the named addressee you should not
>> > disseminate, distribute or copy this e-mail. Please notify the sender
>> > immediately by e-mail if you have received this e-mail by mistake and
>> delete
>> > this e-mail from your system. E-mail transmission cannot be guaranteed
to
>> be
>> > secure or error-free as information could be intercepted, corrupted,
>> lost,
>> > destroyed, arrive late or incomplete, or contain viruses. The sender
>> > therefore does not accept liability for any errors or omissions in the
>> > contents of this message, which arise as a result of e-mail
transmission.
>> If
>> > verification is required please request a hard-copy version. Marywood
>> > University, 2300 Adams Ave., Scranton, PA 18509, USA,
www.marywood.edu.
>> > --
>> > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
>> list
>> > To post a message email: MIDRANGE-L@xxxxxxxxxxxx
>> > To subscribe, unsubscribe, or change list options,
>> > visit: http://lists.midrange.com/mailman/listinfo/midrange-l
>> > or email: MIDRANGE-L-request@xxxxxxxxxxxx
>> > Before posting, please take a moment to review the archives
>> > at http://archive.midrange.com/midrange-l.
>> >
>> >
>>
>>
>>
>> --
>> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
>> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
>> To subscribe, unsubscribe, or change list options,
>> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
>> or email: MIDRANGE-L-request@xxxxxxxxxxxx
>> Before posting, please take a moment to review the archives
>> at http://archive.midrange.com/midrange-l.
>>
>>
>
>
> --
> Joel Burke
> Programmer/Analyst
> MARYWOOD UNIVERSITY
> 2300 Adams Ave.
> Scranton, PA 18509
> (570)348-6211
>
> This message contains confidential information and is intended only for
the
> individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
delete
> this e-mail from your system. E-mail transmission cannot be guaranteed to
be
> secure or error-free as information could be intercepted, corrupted,
lost,
> destroyed, arrive late or incomplete, or contain viruses. The sender
> therefore does not accept liability for any errors or omissions in the
> contents of this message, which arise as a result of e-mail transmission.
If
> verification is required please request a hard-copy version. Marywood
> University, 2300 Adams Ave., Scranton, PA 18509, USA, www.marywood.edu.
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>
>



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




--
Joel Burke
Programmer/Analyst
MARYWOOD UNIVERSITY
2300 Adams Ave.
Scranton, PA 18509
(570)348-6211

This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message, which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. Marywood
University, 2300 Adams Ave., Scranton, PA 18509, USA, www.marywood.edu.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.