I am creating a Web using JavaEE + Tomcat, and I would like to know what would be the best way to execute a GNU/Linux Shell command and, if possible, to know if there has been an error in the execution of the command.
How to manage if it is an administrative command for which I must have root permissions to execute it? For example, how to execute the following command that I normally execute as follows in the Shell:
#bash ~/my_script.sh
(with root permissions)