Hey smoker! What you been smoking?!
The /usr/sbin/ndb_mgmd command will run just fine without a surrounding $( ) and will not run with its arguments enclosed in double quotes as in "$configini --ndb-nodeid=$managementnodeid $initial --configdir=$configdir"
because that will pass a single argument instead of several words.
And there is no need to double quote variables to expand them into their contents. If they contain embedded whitespace it may be necessary to avoid them being split into words at the whitespace but not when they are on the RHS of an assignment as in configini=$configdir/config.ini
. It would work as configini="$configdir/config.ini"
but such double quoting is not necessary.
@jgonsalves: IDK the ndb_mgm command but "$managementnodeid stop"
is unusual; does it really need to be a single word? Should it not be "$managementnodeid" stop
? If so it's surprising that the script works when "run from the console
". Are you 100% sure it works then?