We are using oswatcher in our environment which runs and collects diagnostic information on Redhat linux 5.6 /6.4 versions. This is scheduled under root which runs and collects information on iostat,network stat, cpu etc for every 30 seconds and keeps all the information in .dat files (flat file) in archive directory.

Now we do analyze based on interactive commands provided by oswatcher black box analyzer. we are looking to automate analysis using shell script which runs every 24 hours to mine the 24 hours data and generate a dash board.
the below is command to generate dashboard where it needs three input parameters . one is

java -jar oswbba.jar -i /opt/oracle/tfa/repository/suptools/<HOSTNAME>/oswbb/oracle/archive 

--now interactively it expect one of the options to be provided as input.

Enter X to Export Parsed Data to Flat File
Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale)
Enter A to Analyze Data
Enter D to Generate DashBoard

Enter Q to Quit Program

Please Select an Option:   << 1 or 2 or D (dashboard) >> 

( here i want to provide the input as D . This input i need to pass it as value in shell script ) . how can we acheive. in the same way , the second input is name of directory and path of directory to be created for analysis.

All these three parameters need to be passed in shell script for automation of analysis.

regards Kumar


When you say it takes input interactively, that means it's reading from stdin. We can replicate this by echoing the input to the process's stdin:

echo "D" | java -jar oswbba.jar -i /opt/oracle/tfa/repository/suptools/<HOSTNAME>/oswbb/oracle/archive

Note that echo automatically ends with a newline character.

If you needed additional input, you can do:

echo -e "D\n<next_input>\n<next_input>" | ...

The -e flag enables interpretation of escape sequences such as \n.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.