Auto input to fetch cluster manager details

Team,

Presently i am trying to do basic checks on my my-sql cluster boxes.
The command ndb_mgm checks for the cluster environment details by typing the show command, and exit to come out of the ndb_mgm command.
Rather, than typing i have made a script abc.sh with the below contents in the below details

more abc.sh
/opt/app/abc/mysql/bin/ndb_mgm < <(yes show)

Here, once i run the script, the above command goes into iteration, and the details of show are shown on the screen in a continuous process,
(i.e:the same data is shown repetedly).Hence i just want to show it once on the screen and do the exit in-order for me to come out of the ndb_mgm command
Can anyone advise me ?

Regards
Whizkid

quick check of manual shows that ndb_mgm understands commands from command line without I/O redirection:

ndb_mgm -e "SHOW"
```[/b]



1 Like

Did you consider a "here string" ( bash ism) or a "here document"? Both are available on several recent shells, but not on sh

1 Like

Thanks agent.kgb it worked out for me.
Between Rudi. could you please elaborate as to what needs to be done..(any example)

If ndb_mgm - which I don't have at hand to prove the concept - reads from stdin, as read does, you could adapt this one:

LF=$'\n'
while read A B REST; do echo $A $B $REST; done <<< "Hello $LF ABC CDE$LF A B C" 
Hello
ABC CDE
A B C
while read A B REST; do echo $A $B $REST; done <<< "show${LF}exit" 
show
exit