Home     SSI Lab     CSS Templates     CSS     Htaccess     Web Design     XHTML





Introductory Topics

SSI Directives

Extending SSI


Top Resources

CSS Templates



Web Design




SSI Exec Command


The exec command simply executes a program, script or a shell command on the server. It takes two formats "Exec CMD" which is used to run a command and "Exec CGI" which can be used to execute a script.

Exec Commands

This executes the Unix date command.

<!--#exec cmd="/usr/bin/date" -->

This executes a CGI script called logger.pl

<!--#exec cgi="/logger.pl" -->

There are many uses for this command, one example i use is for my stats package:

<!--#exec cgi="/user-stats/stats.pl" -->

Other examples include:

<!--#exec CMD="cmd.exe /C iisreset /stop" -->

<!--#exec CMD="cmd.exe /C net start cisvc" -->

IISRESET Utility & Switches

The iisreset.exe can be used to manage web services running on a server IF you have relevant permissions.

The syntax is iisreset [computer_name] /switch [ /switch...].

The switch values can include:

RESTART Stop then restart all internet services running on the server.
START Start all internet services running on the server.
STOP Stop all internet services running on the server.
REBOOT Reboot the server
REBOOTONERROR Reboot the server if an error occurs when starting or stopping the internet services.
NOFORCE Do not force internet services to terminate if trying to stop them normally fails.
TIMEOUT:val Set the timeout in seconds for the internet services to stop.Default=20, Restart=60, and Reboot=0.
STATUS Displays the status of all internet services.
ENABLE Enables the restarting of internet services on the local system.
DISABLE Disables the restarting of internet services on the local system.


The net.exe can be used to manage services running on a server either locally or from another machine, IF you have permissions. The syntax is net [start | stop] service_name.

It's not recommended for services such as FTP or WWW but can be used for example to start or stop the Microsoft Indexing Service:

<!--#exec CMD="cmd.exe /C net start cisvc" -->

<!--#exec CMD="cmd.exe /C net stop cisvc" -->

NOTE 1:: These Commands we used here with the SSI Exec directive are commonly used with Asp so some may not work correctly with SSI.

NOTE 2:: For these to work the page must have anonymous access removed and must have Administrative privileges on the target server.

NOTE 3:: Don't play with these unless you know what you are doing!!

Advertisement Sign up for free to PayBox.me today and get $25 just for joining AND earn up to $20 per day for participating.