When having a custom module in webmin execute time consuming commands, how would I add a
"please wait" message until the command is finished (without user interaction).

I.e.:

start_please_wait();
system("long_command");
stop_please_wait();

marty