From: Joe C. <jo...@sw...> - 2002-07-22 22:08:59
|
When I wanted to write something like this (that downloaded and installed something) I stole the countdown code from Jamie's download routine (the one that is used during a Webmin upgrade). You can also hold open a browser connection by sending a dot every second or so until the process is finished. I.e.: Installing... And every second send another dot. But this won't maintain state between logins! You'll need to write out a temporary file (can be in the same directory as your module, or the directory where you are installing, or in the /tmp directory, but if there, be sure to protect against various race attacks that writing to a world writable directory can be subject to)...sort of a 'lock' file, except it indicates when the installation is completed. So: Open a file with something like `touch not-finished` (use system() for this, or properly open a file using the open call). Spawn a new process to install the application. This new process needs to be able to detect when the install is finished, so it can delete that temp file. When the install is finished delete the temp file. As long as the tempfile exists, show an 'Installing...' screen. Otherwise do whatever it is you want it to do. If you want interactive users to be able to watch it installing rather than coming back periodically, you'll need to add a reload timeout like this: print qq~<meta http-equiv="refresh" content=10"\n~; If you feel fancy you could make a ticker to indicate the amount of time left in the install, or something similar. Support wrote: > Hello, > > I am wanting to build a simple module that runs a process, and types out > something like "installing...." The key to the module would be that it > would state "installing..." until the program is finished. I would like > the module to "state installing" regardless of logging out of webmin and > later logging back in. In other words, "installing..." would be typed > out until the installation process is over. > > Is a module of this sort possible? can someone provide a some simple > source code? -- Joe Cooper <jo...@sw...> Web caching appliances and support. http://www.swelltech.com |