The #exec CommandThere are occasions when SSI includes and SSI variables cannot achieve the dynamic content you want, but you still don't want to go to the trouble of writing a CGI program to generate the entire page content. By using the #exec command, you can include the output of a program within your HTML pages. The #exec command is followed by the cgi parameter, and a valid CGI program as the attribute.
Simple Example: A CGI to Display Machine LoadTo prove that your server machine is capable, you might want to include a load meter on the machine spec page. The page contains a lot of information and is updated frequently so you don't want a CGI program to generate the complete HTML code. The examples below will obtain the load average of the machine, then determine what colour to display the text. The .shtml file:
The CGI Program:
Possible (this is dynamic after all) result in the HTML:
Executing arbitrary shell commandsThe #exec command can also be used to execute arbitrary shell commands when used with the cmd = tag. For this tag to be available, the server needs to have `CGI enable anywhere' turned on.
The server will execute the equivalent of /bin/sh -c "command" and replace the tag with the output of that command. For example:
|
Recently...
Other Resources
|





