Our business case needs us to call a shell script from a Message Bean. Other than the obvious portability issues, and the standards compliance, what is the problem with calling a shell script from a bean? Technically speaking, the container, WebLogic, will allow me to, but it sure seems like a bad practice. What would a good alternative be? It is a synchronous call in this case.
Share
You have covered the most important ones.
The only others I can think of are:
Bad practice should not be equated with inelegance. Good / bad practice is about things that will / would have a measurable impact according to some objective criterion … if you could measure them.
The general alternative is to code the task in Java. You should be able to do that in the
awk/sedcase. In the case where you are usingpsto look for an external process, you probably can’t do the task at all in pure Java, and that means that your current approach is best.