I have a JBOSS Installer which when run manually it will prompt for input and below is the sample of the execution is as below
[sp@sp baseInstaller]$ ./advStart.sh configBuildfile: /home/sp/jboss/sp/baseInstaller/build.xmlinit:config: [groovy] coa.install.props properties [groovy] [groovy] ? indicates a response is required from you [groovy] [value] is the current value [groovy] to keep current value just press <enter> [groovy] or type new value and press <enter> [groovy] {value,value..} shows the allowed values [groovy] installer version 6.0.3.4 [groovy] [groovy] Jboss Server Config Options (changeable after initial config) [groovy] ------------------------------------------------------------- [groovy] ? host [sp.resource.com]resource.com [groovy] ip=10.50.55.90 [groovy] host changed to resource.com [groovy] ? bind to host only or all ports (all has security implications) [groovy] [host] [groovy] {host,all,custom}all [groovy] bind to host only or all ports (all has security implications) changed to all [groovy] ? min memory [64]64
I tried to frame an expect script to automate this process and below is my script
[sp@sp baseInstaller]$ cat saba.sh#!/usr/bin/expect# Accessing command line argumentsset arg1 [lindex $argv 0]set arg2 [lindex $argv 1]# Printing the argumentsputs "Argument 1: $arg1"puts "Argument 2: $arg2"cd /home/sp/jboss/sp/baseInstallerspawn ./advStart.sh config# Expect the prompt for the argument with a timeout of 10 secondsexpect {"? host [sp.resource.com]" { # Send the host value send "$arg1\r" exp_continue }"? bind to host only or all ports (all has security implications)" { # Send the argument value send "$arg2\r" } timeout { puts "Error: Timed out while waiting for the prompt." exit 1 } eof} -timeout 10# Wait for the script to finishwait
Now while executing this script, it is getting struck in the below place and not proceeding further. Can you please help me about this?
[sp@sp baseInstaller]$ expect saba.sh resource.com allArgument 1: resource.comArgument 2: allspawn ./advStart.sh configBuildfile: /home/sp/jboss/sp/baseInstaller/build.xmlinit:config: [groovy] coa.install.props properties [groovy] [groovy] ? indicates a response is required from you [groovy] [value] is the current value [groovy] to keep current value just press <enter> [groovy] or type new value and press <enter> [groovy] {value,value..} shows the allowed values