Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Give an answer to a question that is asked after a command has been run with in a script.

89 views
Skip to first unread message

jgonz...@gmail.com

unread,
Oct 9, 2012, 5:57:01 PM10/9/12
to
I run a command to start the splunk software and get asked a question. I want to be able to answer the question with a y within the script. I have tried to pass in a y but nothing happens, no y gets printed at the end of the question or when I try to redirect a file with the y still nothing happens. See the different code I have tried and output.
#!/bin/sh
#
set -x
`/opt/splunkforwarder/bin/splunk start` < /var/tmp/answer

[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
++ /opt/splunkforwarder/bin/splunk start
Do you agree with this license? [y/n]:

#!/bin/sh
#
set -x
`/opt/splunkforwarder/bin/splunk start` < y

[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
++ /opt/splunkforwarder/bin/splunk start
Do you agree with this license? [y/n]:

#!/bin/sh
#
set -x
echo "y" | `/opt/splunkforwarder/bin/splunk start`

[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
+ echo y
++ /opt/splunkforwarder/bin/splunk start
Do you agree with this license? [y/n]:

#!/bin/sh
#
set -x
`/opt/splunkforwarder/bin/splunk start` |echo "y"

[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
+ echo y
y
++ /opt/splunkforwarder/bin/splunk start
Do you agree with this license? [y/n]:


[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
++ /opt/splunkforwarder/bin/splunk start
Do you agree with this license? [y/n]:
#!/bin/sh
#
set -x
`/opt/splunkforwarder/bin/splunk start`' <<-EOF >y

[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
++ /opt/splunkforwarder/bin/splunk start
Do you agree with this license? [y/n]:

#!/bin/sh
#
set -x
`/opt/splunkforwarder/bin/splunk start`' << "y"'

[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
++ /opt/splunkforwarder/bin/splunk start
Do you agree with this license? [y/n]:

#!/bin/sh
#
set -x
`/opt/splunkforwarder/bin/splunk start`' <<-EOF
y
EOF

[root@ct-eng-fmq02-devint tmp]# ./splunk.sh
./splunk.sh: line 5: unexpected EOF while looking for matching `''
./splunk.sh: line 9: syntax error: unexpected end of file

Mirko K.

unread,
Oct 9, 2012, 6:48:02 PM10/9/12
to
On 09.10.2012 23:57, jgonz...@gmail.com wrote:
> I run a command to start the splunk software and get asked a
> question. I want to be able to answer the question with a y
> within the script. I have tried to pass in a y but nothing
> happens, no y gets printed at the end of the question or when I
> try to redirect a file with the y still nothing happens. See the
> different code I have tried and output.

[SNIP]

You probably need "expect"

http://www.thegeekstuff.com/2010/10/expect-examples/
http://linux.die.net/man/1/expect

Kaz Kylheku

unread,
Oct 9, 2012, 9:08:34 PM10/9/12
to
On 2012-10-09, jgonz...@gmail.com <jgonz...@gmail.com> wrote:
> I run a command to start the splunk software and get asked a question.

The program seems to be, quite annoyingly, to be opening the controlling
tty, rather than obtaining the answer from standard input.

> [root@ct-eng-fmq02-devint tmp]# ./splunk.sh
> ++ /opt/splunkforwarder/bin/splunk start
> Do you agree with this license? [y/n]:

I'm surprised you have to agree with a license each time you start
the software.

Agreeing with a license ought to be an installation-time concern, not a
run-time one.

Why don't you take it up with splunk's customer support.

Bill Marcum

unread,
Oct 10, 2012, 7:42:49 AM10/10/12
to
On 10/09/2012 05:57 PM, jgonz...@gmail.com wrote:
> I run a command to start the splunk software and get asked a
> question. I want to be able to answer the question with a y within
> the script. I have tried to pass in a y but nothing happens, no y
> gets printed at the end of the question or when I try to redirect a
> file with the y still nothing happens. See the different code I have
> tried and output.
> #!/bin/sh
> #
> set -x
> `/opt/splunkforwarder/bin/splunk start` < /var/tmp/answer
>
Did you really write backquotes around the command each time?
You have no idea what the quotes mean, but you don't need them here.

> #!/bin/sh
> #
> set -x
> echo "y" | `/opt/splunkforwarder/bin/splunk start`
>
This should work if you remove the `backquotes`.

jgonz...@gmail.com

unread,
Oct 10, 2012, 8:55:17 PM10/10/12
to
Bill Marcum

Taking the `backquotes` off just has the whole big license paragraph scroll up but the command still does not work. It echos the y before the question comes out, see below. I am trying to get thei sscript running so I can deploy it to all the servers and run it to install and startup splunk software. See below

echo "y" | /opt/splunkforwarder/bin/splunk start
y
::::::::::::::
/opt/splunkforwarder/license-eula.txt
::::::::::::::
SPLUNK SOFTWARE LICENSE AGREEMENT

THIS SPLUNK SOFTWARE LICENSE AGREEMENT (THE "AGREEMENT") GOVERNS ALL SOFTWARE
PROVIDED BY SPLUNK INC. ("SPLUNK") INCLUDING FREE SPLUNK SOFTWARE ("FREE
SOFTWARE") AND SOFTWARE PURCHASED THROUGH SPLUNK'S ONLINE STORE OR OTHER
CHANNELS ("PURCHASED SOFTWARE"), COLLECTIVELY THE SPLUNK SOFTWARE ("SOFTWARE")
AND ANY AND ALL UPDATES, UPGRADES, AND MODIFICATIONS THERETO. CONFIRMATION OF
YOUR ORDERS ("ORDER CONFIRMATION") WILL BE DEEMED INCORPORATED INTO AND MADE
PART OF THIS AGREEMENT.

YOU WILL BE REQUIRED TO INDICATE YOUR AGREEMENT TO THESE TERMS AND CONDITIONS
IN ORDER TO DOWNLOAD THE SOFTWARE AND REGISTER WITH SPLUNK IN ORDER TO OBTAIN
LICENSE KEYS NECESSARY TO COMPLETE THE INSTALLATION PROCESS FOR PURCHASED
SOFTWARE. BY CLICKING ON THE "YES" BUTTON, DOWNLOADING OR INSTALLING THE
SOFTWARE, OR USING ANY MEDIA THAT CONTAINS THE SOFTWARE, YOU ARE CONSENTING
TO BE BOUND BY THIS AGREEMENT.

IF YOU AGREE TO THESE TERMS ON BEHALF OF A BUSINESS, YOU REPRESENT AND WARRANT
THAT YOU HAVE AUTHORITY TO BIND THAT BUSINESS TO THIS AGREEMENT, AND YOUR
AGREEMENT TO THESE TERMS WILL BE TREATED AS THE AGREEMENT OF THE BUSINESS.
IN THAT EVENT, "YOU" AND "YOUR" REFER HEREIN TO THAT BUSINESS.

"Splunk Developer API" means the documentation and functionality enabling
the creation of extensions to the Software. "Example Modules" means the
source code and binary form of examples that use the Splunk Developer
API.

PURCHASED SOFTWARE TERM. Unless earlier terminated, this Agreement will be
in effect perpetually for any Purchased Software. "Term" means the period in
which the Agreement is in effect.

PURCHASED SOFTWARE FREE TRIAL. Notwithstanding the foregoing, if the
applicable Order Confirmation is limited to a free trial license, then
the Term will be limited to the free trial period specified in the Order
Confirmation, this Agreement and any license rights granted hereunder will
automatically terminate at the end of the free trial period, and there
will be no Renewal Term. Any license keys provided for a free trial will
automatically expire and may cause the Software to become non-operational
at the end of the free trial period. Provisions in this Agreement regarding
License Fees, Maintenance and Support, and Warranty will not apply to free
trials.

PURCHASED SOFTWARE LICENSE. Subject to your compliance with the terms and
conditions of this Agreement, including your payment of the license fees set
forth in each Order Confirmation (the "License Fees"), Splunk grants you a
nonexclusive, nontransferable, revocable, limited license during the Term
to use the Software for which you have paid the applicable License Fees as
set forth in your Order Confirmation(s), only for your internal business
purposes (which shall include use by consultants, accountants, auditors
and attorneys hired to perform services for you) and only subject to the
following conditions: you may use each Splunk Server with an Enterprise
license to index no more than the peak daily volume of uncompressed data
for which you have paid the applicable License Fees as set forth in your
Order Confirmation (the "Maximum Peak Daily Volume"). The Software will be
configured to display warnings and/or cease indexing data when the Maximum
Peak Daily Volume is reached.

FREE SOFTWARE LICENSE. Subject to the terms and conditions of this Agreement,
Splunk grants to You a non-exclusive, worldwide, fully-paid up copyright
license to use the Free Splunk Software in binary form only and only
subject to the following conditions: (i) to index no more than 500MB of
peak daily volume of uncompressed data (the 'Maximum Peak Daily Volume')
and only for your internal business purposes (which shall include use by
consultants, accountants, auditors and attorneys hired to perform services
for you). The Software will be configured to display warnings, reduce
available functionality, and/or cease indexing data when the Maximum Peak
Daily Volume is reached.

EXTENSION LICENSE. Splunk further grants to You a non-exclusive, worldwide,
fully-paid up copyright license to use the Splunk Developer API and Example
Modules included with the Software solely for the purpose of developing
extensions to access the Splunk API or Example Modules for Your use in
conjunction with the Software (collectively, "Your Extensions"). You agree to
assume full responsibility for the performance of Your Extensions, and shall
indemnify, hold harmless, and defend Splunk (including all of its officers,
employees, directors, subsidiaries, representatives, affiliates and agents)
and Splunk's suppliers from and against any claims or lawsuits, including
attorney's fees and expenses, that arise or result from Your Extensions
pursuant to this Agreement. You retain title to and copyright for Your
Extensions, subject to Splunk's title to and copyright for the Software, the
Splunk Developer API, and the Example Modules as specified in Ownership and
Copyrights, below. This Agreement does not grant you any distribution rights.
If you want to distribute or provide to any third parties Your Extensions,
you must first register as a Splunk application developer and agree to the
Splunk Developer Agreement at http://www.splunk.com/goto/devagreement. You
will not remove or change any Splunk copyright notices or branding included
in the Splunk Software or required by Splunk's Identity Guidelines as set
forth at http://www.splunk.com/goto/splunkpowered, Splunk Developer APIs,
or Example Modules, and will include such notices and branding in each copy
of Your Extensions, the Splunk Software, the Splunk Developer APIs, and the
Examples Modules that you make or distribute.
PUBLICITY. You agree that Splunk may identify you as a Splunk customer on
Splunk websites, client lists, press releases, and/or other marketing. You
also agree that Splunk may publish a brief description highlighting your
deployment of the Software.

GENERAL. This Agreement shall be governed by and construed in accordance
with the laws of the State of California, as if performed wholly within the
state and without giving effect to the principles of conflict of law. Any
legal action or proceeding arising under this Agreement will be brought
exclusively in the federal or state courts located in the Northern District
of California and the parties hereby consent to personal jurisdiction and
venue therein. If any portion hereof is found to be void or unenforceable,
the remaining provisions of this Agreement shall remain in full force and
effect. Neither party may assign this Agreement, in whole or in part, except
in connection with an internal reorganization or a sale of the business with
which this Agreement is associated without Splunk's prior written consent,
and any attempt to assign this Agreement other than as permitted above will
be null and void. This Agreement is intended for the sole and exclusive
benefit of the parties and is not intended to benefit any third party.
Only the parties to this Agreement may enforce it. This Agreement and any
Order Confirmations constitute the complete and exclusive understanding and
agreement between the parties regarding their subject matter and supersede
all prior or contemporaneous agreements or understandings, written or oral,
relating to their subject matter. Any waiver, modification or amendment of
any provision of this Agreement will be effective only if in writing and
signed by duly authorized representatives of both parties.

Icarus Sparry

unread,
Oct 10, 2012, 9:47:44 PM10/10/12
to
On Wed, 10 Oct 2012 17:55:17 -0700, jgonza1495 wrote:

> On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
>> I run a command to start the splunk software and get asked a question.
>> I want to be able to answer the question with a y within the script. I
>> have tried to pass in a y but nothing happens, no y gets printed at the
>> end of the question or when I try to redirect a file with the y still
>> nothing happens. See the different code I have tried and output.
>>
[snip]


> Taking the `backquotes` off just has the whole big license paragraph
> scroll up but the command still does not work. It echos the y before the
> question comes out, see below. I am trying to get thei sscript running
> so I can deploy it to all the servers and run it to install and startup
> splunk software. See below
>
> echo "y" | /opt/splunkforwarder/bin/splunk start
> y
> ::::::::::::::
> /opt/splunkforwarder/license-eula.txt
> ::::::::::::::
> SPLUNK SOFTWARE LICENSE AGREEMENT
>
> THIS SPLUNK SOFTWARE LICENSE AGREEMENT (THE "AGREEMENT") GOVERNS ALL
> SOFTWARE PROVIDED BY SPLUNK INC. ("SPLUNK") INCLUDING FREE SPLUNK
> SOFTWARE ("FREE SOFTWARE") AND SOFTWARE PURCHASED THROUGH SPLUNK'S
[ 120 more lines of license]
> waiver, modification or amendment of any provision of this Agreement
> will be effective only if in writing and signed by duly authorized
> representatives of both parties.
> Do you agree with this license? [y/n]:

So it looks like /opt/splunkforwarder/bin/splunk might be a script and it
is using a program such as "more" to page out the license file, and then
read the user response.

You could try seeing if a delay works, e.g.

{ sleep 3 ; echo y ; } | /opt/splunkforwarder/bin/splunk start

You could see if 'expect is installed. If so then

#!/usr/bin/enc expect
spawn /opt/splunkforwarder/bin/splunk start
expect {\[y/n]: } { send -- y\r }
interact


might do the trick. If you have expect then you probably also have
"autoexpect", which can write this stuff for you. Just type

autoexpect -p /opt/splunkforwarder/bin/splunk start

do whatever you need, and then when you have finished autoexpect
will write an expect program to repeat it.

You could see if /opt/splunkforwarder/bin/splunk is actually a script and
see if the license allows you to change it. If se just remove the test
to see if you have accepted the license.

You could ask Splunk Software why they require you to accept the license
each time, rather than remember that you have agreed to it. If they can't
even do that simple step then you might wonder how much value there is in
the rest of their software.

jgonz...@gmail.com

unread,
Oct 11, 2012, 1:51:34 AM10/11/12
to
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
Tcarus running the command { sleep 3 ; echo y ; } | /opt/splunkforwarder/bin/splunk start does not work even with the delay it prints out the y before the license paragraph comes up, see below. Even if I put the splunk start in front of th echo y it still does not work.

[root@ct-eng-fmq02-devint tmp]# { sleep 3 ; echo y ; } | /opt/splunkforwarder/bin/splunk start
y
::::::::::::::
/opt/splunkforwarder/license-eula.txt
::::::::::::::
SPLUNK SOFTWARE LICENSE AGREEMENT

THIS SPLUNK SOFTWARE LICENSE AGREEMENT (THE "AGREEMENT") GOVERNS ALL SOFTWARE
PROVIDED BY SPLUNK INC. ("SPLUNK") INCLUDING FREE SPLUNK SOFTWARE ("FREE

jgonz...@gmail.com

unread,
Oct 11, 2012, 2:04:03 AM10/11/12
to
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
Icarus when I run this command I get the y to come out after the question but it just sits there and does not return.
{ sleep 3 ; echo y ; } | /opt/splunkforwarder/bin/splunk start | { sleep 3 ; echo y ; }
Do you agree with this license? [y/n]: y

Icarus Sparry

unread,
Oct 11, 2012, 8:54:02 AM10/11/12
to
On Wed, 10 Oct 2012 23:04:03 -0700, jgonza1495 wrote:

> On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
>> I run a command to start the splunk software and get asked a question.
>> I want to be able to answer the question with a y within the script. I
>> have tried to pass in a y but nothing happens, no y gets printed at the
>> end of the question or when I try to redirect a file with the y still
>> nothing happens. See the different code I have tried and output.

> Icarus when I run this command I get the y to come out after the
> question but it just sits there and does not return.
> { sleep 3 ; echo y ; } | /opt/splunkforwarder/bin/splunk start | { sleep
> 3 ; echo y ; }
> Do you agree with this license? [y/n]: y

Interesting, but not too unexpected.

Looking at the parts, the first '{ sleep 3 ; echo y ; }' pauses for 3
seconds and then outputs a 'y' and a newline. This is fed into the splunk
start command. The output of the splunk start command (the 140 lines of
license agreement) is fed into the second '{ sleep 3 ; echo y ; }', which
doesn't do anything with it and then outputs the 'y' after 3 seconds.

The fact that you see the 'Do you agree' means that the program is either
printing this message to stderr or to /dev/tty. If the latter then it is
probably reading the response from /dev/tty as well.

You could try (all on one line)

{ sleep 3 ; echo y ; sleep 20 ; } | ssh -t localhost /opt/splunkforwarder/
bin/splunk start

This assumes you have 'ssh' set up and arranged it so it doesn't need a
password. If you have 'rsh' or 'telnet' access to the machine then you
can do something simular. Can you tell us what the output of the
following two commands are

file /opt/splunkforwarder/bin/splunk
wc /opt/splunkforwarder/bin/splunk

are?

jgonz...@gmail.com

unread,
Oct 11, 2012, 11:26:34 AM10/11/12
to
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
Icarus the output of file /opt/splunkforwarder/bin/splunk and wc /opt/splunkforwarder/bin/splunk are below.

file /opt/splunkforwarder/bin/splunk
/opt/splunkforwarder/bin/splunk: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.4.0, stripped

wc /opt/splunkforwarder/bin/splunk
828 7078 260800 /opt/splunkforwarder/bin/splunk

jgonz...@gmail.com

unread,
Oct 11, 2012, 2:17:19 PM10/11/12
to
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
I ran the expect script below but it required me to hit enter while the license paragraph scrolled up the screen and when it got to the question part no y was put in by the expect script.

[root@ct-eng-fmq02-devint tmp]# more splk.exp
#!/usr/bin/expect
spawn /opt/splunkforwarder/bin/splunk start
expect {\[y/n]]: } {send -- y\r }
interact

Output of the script above.
EXTENSION LICENSE. Splunk further grants to You a non-exclusive, worldwide,
fully-paid up copyright license to use the Splunk Developer API and Example
Modules included with the Software solely for the purpose of developing
extensions to access the Splunk API or Example Modules for Your use in
conjunction with the Software (collectively, "Your Extensions"). You agree to
assume full responsibility for the performance of Your Extensions, and shall
indemnify, hold harmless, and defend Splunk (including all of its officers,
employees, directors, subsidiaries, representatives, affiliates and agents)
and Splunk's suppliers from and against any claims or lawsuits, including
attorney's fees and expenses, that arise or result from Your Extensions
pursuant to this Agreement. You retain title to and copyright for Your
Extensions, subject to Splunk's title to and copyright for the Software, the
Splunk Developer API, and the Example Modules as specified in Ownership and
Copyrights, below. This Agreement does not grant you any distribution rights.
If you want to distribute or provide to any third parties Your Extensions,
you must first register as a Splunk application developer and agree to the
Splunk Developer Agreement at http://www.splunk.com/goto/devagreement. You
will not remove or change any Splunk copyright notices or branding included
in the Splunk Software or required by Splunk's Identity Guidelines as set
forth at http://www.splunk.com/goto/splunkpowered, Splunk Developer APIs,
or Example Modules, and will include such notices and branding in each copy
of Your Extensions, the Splunk Software, the Splunk Developer APIs, and the
Examples Modules that you make or distribute.

PURCHASED SOFTWARE RESTRICTIONS. You agree not to (i) use the Software except
as expressly authorized in this Agreement and your Order Confirmation; (ii)
copy the Software (except as required to run the Software and for reasonable
backup purposes); (iii) modify, adapt, or create derivative works of the
Software; (iv) rent, lease, loan, resell, transfer, sublicense (including but
not limited to offering any of the functionality of the Software on a service
provider, hosted or time sharing basis) or distribute the Software to any
third party; (v) decompile, disassemble or reverse-engineer the Software or
otherwise attempt to derive the Software source code; (vi) disclose to any
third party the results of any benchmark tests or other evaluation of the
Software, or (vii) authorize any third parties to do any of the above.

FREE SOFTWARE RESTRICTIONS. You shall not (i) decompile, disassemble or
reverse engineer the Free Software without the express written authorization
of Splunk; (ii) modify, adapt, or create derivative works of the Free
Software; (iii) rent, lease, loan, or resell the Free Software, the Splunk
Developer API, Example Modules, or Your Extensions (including but not limited
to offering the functionality of the Free Software on an applications
service provider or time sharing basis), except as expressly permitted in
the Splunkbase Application Developer Agreement; (iv) decompile, disassemble
or reverse-engineer the Software or otherwise attempt to derive the Software
source code; (v) disclose to any third party the results of any benchmark
tests or other evaluation of the Software, or (vi) authorize any third
parties to do any of the above.

OWNERSHIP. Splunk and/or its licensors own all worldwide right, title and
interest in and to the Software, including all worldwide intellectual
property rights therein. You will not delete or in any manner alter the
copyright, trademark, and other proprietary rights notices appearing in
or on the Software as provided. All right, title, and interest in and to
all copies the Splunk Developer API, and the Example Modules remains with
Splunk and/or its licensors. The Software, Splunk Developer API, and Example
Modules are copyrighted and protected by the laws of the United States and
other countries, and international treaty provisions. You may not remove any
copyright notices from the Software, the Splunk Developer API, or the Example
Modules.

PURCHASED SOFTWARE LICENSE AND FEES. In order to access and use the Software,
you are required to pay to Splunk the License Fees in accordance with your
Order Confirmation. The License Fees will be due and payable in accordance
with the terms set forth in your Order Confirmation. Any failure to pay
the License Fees in accordance with an Order Confirmation will result in
automatic revocation and termination of this Agreement and all rights and
licenses granted hereunder. All License Fees are non-refundable once paid.

MAINTENANCE AND SUPPORT. Subject to your payment of the applicable annual
maintenance and support fees set forth in your Order Confirmation (the
"Support Fees"), Splunk will provide the level of support for the Purchased
Software identified in your Order Confirmation in accordance with the support
descriptions set forth on Splunk's website at www.splunk.com. Splunk is not
obligated to support, update or upgrade the Free Software.

PURCHASED SOFTWARE VERIFICATION AND AUDIT. At Splunk's written request, you
will furnish Splunk with a certification signed by an officer of your company
verifying that the Software is being used in accordance with the terms and
conditions of this Agreement and the applicable Order Confirmations. Upon
at least ten (10) days prior written notice, Splunk may audit your use of
the Software to ensure that you are in compliance with the terms of this
Agreement and the applicable Orders. Any such audit will be conducted during
regular business hours at your facilities, will not unreasonably interfere
with your business activities and will be in compliance with your reasonable
security procedures. You will provide Splunk with access to the relevant
records and facilities. If an audit reveals that you have exceeded the daily
peak volume during the period audited, then Splunk will invoice you, and you
will promptly pay Splunk any underpaid fees based on Splunk's price list in
effect at the time the audit is completed. If the daily peak volume usage
exceeds ten percent (10%) of the licensed usage, then you will also pay
Splunk's reasonable costs of conducting the audit.

PURCHASED SOFTWARE WARRANTY. Splunk warrants that for a period of thirty (30)
days after your registration of the Software with Splunk, the Software will
substantially achieve any material function described in documentation for
the Software published by Splunk. As Splunk's sole liability and your sole
remedy for any failure of the Software to conform to this warranty, Splunk
will repair or replace (at Splunk's option) your copy of the Software.

WARRANTY DISCLAIMER. EXCEPT AS SET FORTH ABOVE, SPLUNK DISCLAIMS ANY AND
ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
NONINFRINGEMENT, QUIET ENJOYMENT AND WARRANTIES ARISING OUT OF COURSE OF
DEALING OR USAGE OF TRADE. Splunk does not warrant (i) that the Software,
developer's API'S or example modules will meet your requirements, (ii) that
the Software will operate in the combinations that you may select, (iii)
that the Software will serve the purposes intended by you, or (iv) that the
operation of the Software will be error free or uninterrupted or that any
Software errors will be corrected.

LIMITATION OF LIABILITY. SPLUNK'S TOTAL CUMULATIVE LIABILITY TO YOU, FROM ALL
CAUSES OF ACTION AND ALL THEORIES OF LIABILITY, WILL BE LIMITED TO AND WILL
NOT EXCEED THE AMOUNTS PAID BY YOU TO SPLUNK IN THE TWELVE MONTHS PRIOR TO
THE EVENT GIVING RISE TO SUCH LIABILITY. IN NO EVENT WILL SPLUNK BE LIABLE TO
YOU FOR ANY SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL OR PUNITIVE DAMAGES
(INCLUDING LOSS OF USE, DATA, OR PROFITS, BUSINESS INTERRUPTION, OR COSTS
OF PROCURING SUBSTITUTE SOFTWARE) ARISING OUT OF OR IN CONNECTION WITH THIS
AGREEMENT OR THE USE OR PERFORMANCE OF THE SOFTWARE, WHETHER SUCH LIABILITY
ARISES FROM CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY
OR OTHERWISE, AND WHETHER OR NOT SPLUNK HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH LOSS OR DAMAGE. THE PARTIES HAVE AGREED THAT THESE LIMITATIONS WILL
SURVIVE AND APPLY EVEN IF ANY REMEDY IS FOUND TO HAVE FAILED OF ITS ESSENTIAL
PURPOSE. WITHOUT LIMITING THE FOREGOING, SPLUNK WILL HAVE NO LIABILITY OR
RESPONSIBILITY FOR ANY BUSINESS INTERRUPTION OR LOSS OF DATA ARISING FROM THE
AUTOMATIC TERMINATION OF THE LICENSE RIGHTS GRANTED HEREIN AND ANY ASSOCIATED
CESSATION OF THE SOFTWARE FUNCTIONS. BECAUSE SOME STATES OR JURISDICTIONS DO
NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE
ABOVE LIMITATION MAY NOT APPLY TO YOU.

PURCHASED SOFTWARE INDEMNITY. Splunk will defend, indemnify and hold you
harmless from and against any loss, damage, liability or cost (including
reasonable attorneys' fees) resulting from any third party claim that the
Purchased Software infringes or violates any third party's patent, copyright
or trademark rights; provided that you promptly notify Splunk in writing of
any and all such claims. In the event of any loss, damage, liability or cost
for which Splunk is obligated to indemnify you hereunder, Splunk shall have
sole control of the defense and all related settlement negotiations, and
you shall reasonably cooperate with Splunk in the defense and/or settlement
thereof at Splunk's expense; provided that you may participate in such
defense using your own counsel, at your own expense.

TERMINATION. You may terminate this Agreement at any time by destroying or
returning to Splunk all copies of the Software, including any documentation,
in your possession and control, and providing to Splunk a written statement
signed by an authorized representative of your company notifying Splunk
that you are terminating the Agreement and certifying such destruction
or return. Upon thirty days notice, Splunk may terminate this Agreement
(and your license rights) upon notice in the event that you breach any
provision of this Agreement and have not cured the breach during such notice
period. Upon any expiration or termination of this Agreement, the rights
and licenses granted hereunder will automatically terminate, and you agree
to immediately cease using the Software and to return or destroy all copies
of the Software in your possession or control. In the event of termination
of this Agreement, Splunk will have no obligation to refund any License
Fees, Support Fees, or other fees received from you during the Term. All
provisions of this Agreement related to disclaimers of warranties, limitation
of liability, remedies, damages, or Splunk's proprietary rights shall survive
termination.

SEVERABILITY. All rights and remedies, whether conferred hereunder or by any
other instrument or law, will be cumulative and may be exercised singularly
or concurrently. Failure by either Splunk or You to enforce any term will not
be deemed a waiver of future enforcement of that or any other term. The terms
and conditions stated herein are declared to be severable. Should any term(s)
or condition(s) of this Agreement be held to be invalid or unenforceable
the validity, construction and enforceability of the remaining terms and
conditions of this Agreement shall not be affected.

EXPORT. You agree to comply fully with all relevant export laws and
regulations of the United States ("Export Laws") to ensure that the Software
is not (i) exported or re-exported directly or indirectly in violation of
Export Laws; or (ii) intended to be used for any purposes prohibited by the
Export Laws, including but not limited to nuclear, chemical, or biological
weapons proliferation.

GOVERNMENT RESTRICTED RIGHTS. The Software shall be classified as "commercial
computer software" as defined in the applicable provisions of the Federal
Acquisition Regulation (the "FAR") and supplements thereto, including the
Department of Defense (DoD) FAR Supplement (the "DFARS"). The parties
acknowledge that the Software was developed entirely at private expense and
that no part of the Software was first produced in the performance of a
Government contract. If the Software is supplied for use by DoD, the Software
is delivered subject to the terms of this Agreement and in accordance with
DFARS 227.7202-1(a) and 227.7202-3(a) (1995), with restricted rights in
accordance with DFARS 252.227-7013(c)(1)(ii) (OCT 1988), as applicable. If
the Software is supplied for use by a Federal agency other than DoD, the
Software is restricted computer software delivered subject to the terms
of this Agreement and FAR 12.212(a) (1995); (ii) FAR 52.227-19; or FAR
52.227-14(ALT III), as applicable.

PUBLICITY. You agree that Splunk may identify you as a Splunk customer on
Splunk websites, client lists, press releases, and/or other marketing. You
also agree that Splunk may publish a brief description highlighting your
deployment of the Software.

GENERAL. This Agreement shall be governed by and construed in accordance
with the laws of the State of California, as if performed wholly within the
state and without giving effect to the principles of conflict of law. Any
legal action or proceeding arising under this Agreement will be brought
exclusively in the federal or state courts located in the Northern District
of California and the parties hereby consent to personal jurisdiction and
venue therein. If any portion hereof is found to be void or unenforceable,
the remaining provisions of this Agreement shall remain in full force and
effect. Neither party may assign this Agreement, in whole or in part, except
in connection with an internal reorganization or a sale of the business with
which this Agreement is associated without Splunk's prior written consent,
and any attempt to assign this Agreement other than as permitted above will
be null and void. This Agreement is intended for the sole and exclusive
benefit of the parties and is not intended to benefit any third party.
Only the parties to this Agreement may enforce it. This Agreement and any
Order Confirmations constitute the complete and exclusive understanding and
agreement between the parties regarding their subject matter and supersede
all prior or contemporaneous agreements or understandings, written or oral,
relating to their subject matter. Any waiver, modification or amendment of
any provision of this Agreement will be effective only if in writing and
signed by duly authorized representatives of both parties.

Mirko K.

unread,
Oct 11, 2012, 3:21:55 PM10/11/12
to
jgonz...@gmail.com wrote:

> I ran the expect script below but it required me to hit enter while the
> license paragraph scrolled up the screen and when it got to the question
> part no y was put in by the expect script.
>
> [root@ct-eng-fmq02-devint tmp]# more splk.exp
> #!/usr/bin/expect
> spawn /opt/splunkforwarder/bin/splunk start
> expect {\[y/n]]: } {send -- y\r }
> interact

Try this expect script:

#!/usr/bin/expect
spawn /opt/splunkforwarder/bin/splunk start
expect "\[y/n]]:"
send "y\r"
interact


(And, BTW, please improve your posting style. In particular snip non-
relevant parts from the post to which you reply. And please don't repost
that entire license all the time. Thank you. :-) )

Mirko K.

unread,
Oct 11, 2012, 3:31:51 PM10/11/12
to
Mirko K. wrote:

> jgonz...@gmail.com wrote:
>
>> I ran the expect script below but it required me to hit enter while the
>> license paragraph scrolled up the screen and when it got to the question
>> part no y was put in by the expect script.
>>
>> [root@ct-eng-fmq02-devint tmp]# more splk.exp
>> #!/usr/bin/expect
>> spawn /opt/splunkforwarder/bin/splunk start
>> expect {\[y/n]]: } {send -- y\r }
>> interact
>
> Try this expect script:
>
> #!/usr/bin/expect
> spawn /opt/splunkforwarder/bin/splunk start
> expect "\[y/n]]:"
> send "y\r"
> interact


Sorry, I missed the part about a pager showing the license. So, if you
really need to hit Enter repeatly, try the following. Adjust the amount of
"\r" to the number of times you need to hit Enter to reach the end of the
license.

#!/usr/bin/expect
spawn /opt/splunkforwarder/bin/splunk start
send "\r\r\r"

jgonz...@gmail.com

unread,
Oct 11, 2012, 6:20:28 PM10/11/12
to
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
Ran the below and no y gets printed after the question comes up.
#!/usr/bin/expect
spawn /opt/splunkforwarder/bin/splunk start
expect "\[y/n]:"
send "y\r\r"
interact

out put is "Do you agree with this license? [y/n]:" and sits there waiting for input something and hit enter. That is not what I want. I want the script to type a y at the end of the question and send a caraige return so the splunk daemons can startup.

Icarus Sparry

unread,
Oct 11, 2012, 9:48:35 PM10/11/12
to
Or, since the original poster has 'expect', see if you also have
'autoexpect'. If so then run

autoexpect -p /opt/splunkforwarder/bin/splunk start

press the returns as needed to page through the license, answer the
question with a 'y' and return etc. When the program ends you will have a
file 'script.exp' in the current directory. To start this program in the
future just run './script.exp'

Icarus Sparry

unread,
Oct 11, 2012, 9:50:14 PM10/11/12
to
On Thu, 11 Oct 2012 08:26:34 -0700, jgonza1495 wrote:

> On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
>> I run a command to start the splunk software and get asked a question.
>> I want to be able to answer the question with a y within the script. I
>> have tried to pass in a y but nothing happens, no y gets printed at the
>> end of the question or when I try to redirect a file with the y still
>> nothing happens.
[snip]
>
> Icarus the output of file /opt/splunkforwarder/bin/splunk and wc
> /opt/splunkforwarder/bin/splunk are below.
>
> file /opt/splunkforwarder/bin/splunk /opt/splunkforwarder/bin/splunk:
> ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
> (uses shared libs), for GNU/Linux 2.4.0, stripped
>
> wc /opt/splunkforwarder/bin/splunk 828 7078 260800
> /opt/splunkforwarder/bin/splunk

OK, so it is executable. Pity! See my other answer in this thread.

jgonz...@gmail.com

unread,
Oct 12, 2012, 12:28:03 AM10/12/12
to
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
I did run autoexpect -p /opt/splunkforwarder/bin/splunk start and it did create a expect script script.exp. I copied that expect scripts(script.exp)to another server and ran it it got to this point and hit enter or space bar nothing happens. This royally sucks.
purposes (which shall include use by consultants, accountants, auditors
and attorneys hired to perform services for you) and only subject to the
following conditions: you may use each Splunk Server with an Enterprise
license to index no more than the peak daily volume of uncompressed data
--More--(16%)

jgonz...@gmail.com

unread,
Oct 12, 2012, 12:31:47 AM10/12/12
to
On Tuesday, October 9, 2012 2:57:01 PM UTC-7, (unknown) wrote:
I for got to show the script.exp the contenance.
#!/usr/bin/expect -f
set timeout -1
spawn /opt/splunkforwarder/bin/splunk start
match_max 100000
expect -exact "[7m--More--(7%)[27m"
send -- " "
expect -exact "[7m--More--(17%)[27m"
send -- " "
expect -exact "[7m--More--(26%)[27m"
send -- " "
expect -exact "[7m--More--(36%)[27m"
send -- " "
expect -exact "[7m--More--(46%)[27m"
send -- " "
expect -exact "[7m--More--(55%)[27m"
send -- " "
expect -exact "[7m--More--(65%)[27m"
send -- " "
expect -exact "[7m--More--(75%)[27m"
send -- " "
expect -exact "[7m--More--(84%)[27m"
send -- " "
expect -exact "[7m--More--(94%)[27m"
send -- " "
expect -exact "Do you agree with this license? \[y/n\]: "
send -- " "
expect -exact "
send -- "y\r"
expect -exact "Do you agree with this license? \[y/n\]: "
send -- "y\r"
expect eof

Icarus Sparry

unread,
Oct 12, 2012, 1:03:05 PM10/12/12
to
The reason why it did this is because you either had a different license
file or a different screen size. The script was looking for it to say
17%, not 16%.

However we are getting closer. Try

#!/usr/bin/expect -f
set timeout 2
set match_max 100
expect -exact "27m" { send -- " " ; exp_continue ; } "y/n\] : "
send -- y
expect eof


PLEASE cut down on the amount you are quoting, and please reply to the
latest message in the thread.

jgonz...@gmail.com

unread,
Oct 13, 2012, 2:17:47 AM10/13/12
to
Icarus,

Thanks a lot that worked. You were a big help.
0 new messages