Schedule starting, stopping, restarting, or publishing services on ArcGIS Server

There are situations where starting, stopping, restarting, or publishing services in ArcGIS Server need to be automated. This is for maintenance reasons, for example, restarting at a time when no users are logged on, or to account for updates to data, for example, restarting after new data for a time aware map service has been added. These tasks can be automated through the combined use of the AGSSOM utility, a batch file, and the Windows Task Scheduler tool.

Scheduling service operations in ArcGIS Server
Scheduling these tasks involves downloading a utility called AGSSOM and then creating a batch file to pass in the required parameters and run it. Parameters include the Service Name, Service Type and the desired operation, such as Start, Stop, Restart, and Publish. The Task Scheduler Wizard in Windows is used to run the batch file at a desired time and interval. There are two important things to keep in mind when using the AGSSOM utility.
 * The Service Type defaults to MapService.
 * Service Names and Service Types are case sensitive.

The following instructions describe how to schedule starting, stopping, restarting, and publishing services on ArcGIS Server.


 * 1) To use AGSSOM, download the ZIP file and extract its contents to a server. There are two versions available for download, one for ArcGIS Server 9.3.1 and for ArcGIS Server 10. Select the appropriate one. The AGSSOM.exe can be found in its respective file path based on version.
 * 2) * \\AGSSOMv9.3.1\AGSSOMv9.3.1\bin\x86\Release\
 * 3) * \\AGSSOMv10.0.2\AGSSOMv10.0.2\bin\x86\Release
 * 4) AGSSOM.exe is capable of performing the following operations:
 * 5) * s (START)
 * 6) * x (STOP)
 * 7) * r (RESTART)
 * 8) * p (Pause)
 * 9) * LIST
 * 10) * LISTTYPES
 * 11) * DESCRIBE
 * 12) * PUBLISH
 * 13) * STATS
 * I. Specify which operations need be applied to which services. The text provided below illustrates the required formats. If omitted, the server argument is default to the local host.
 * [[Image: Text1.png |none|frameless|border|600px]]
 * II. Open a blank textfile (.txt) and enter the desired commands. A few examples have been provided below.
 * [[Image: Commands.png |none|frameless|border|600px]]
 * Note: For services other than map services, the ‘mapserver’ component of the string must be updated. Also, the publish command requires the use of double quotation marks ("...") in all cases.
 * III. Once written, save the text file and manually change its extension from .txt to .bas. With a .bas extension, the file acts as a batch file. Double-clicking it runs the .exe using the parameters provided.
 * Note: It is recommended that the code be tested to verify that the map services execute successfully.
 * 1) Schedule the batch file execution using the Task Scheduler Wizard. The instructions provided below describe how to use the Task Scheduler Wizard in Windows 7 to automate the tasks from the batch file.
 * I. Open the Task Scheduler Wizard by clicking Start > All Programs > Accessories > System Tools > Task Scheduler.
 * II. Click ‘Create Basic Task’ under Actions in the Task Scheduler window.
 * III. Type a Name and Description for the task, and click Next.
 * IV. Specify how often the task should occur, and click Next.
 * V. Specify when the task should occur, and click Next.
 * VI. Select the ‘Start a Program’ option, and click Next.
 * VII. Navigate to the batch file, and click Next.
 * VIII. Click Finish.
 * 1) Verify that Windows can successfully execute the batch file.
 * I. Find the newly created task in the ‘Active Tasks’ window and double-click it.
 * II. Click Run to test whether or not it works. The batch script should execute successfully.


 * The services are now starting up as specified at the programmed time.

External Link

 * AGSSOM