Stop caching with python

07-06-2017 01:03 AM
New Contributor III

Hello Everyone,

i use a python script to cache a AGS Service time scheduled over night. But i can't find a way to stop the caching Service. I want to Stop the caching in the business time, an start it again in the night (RECREATE_EMPTY_TILES).

Please help me out.


Thank you i advance.

# Import arcpy module
import arcpy

# Local variables:
Bildflug_OBK_MapServer = "GIS Servers\\arcgis on localhost_6080 (Admin)\\orthophotos\\Bildflug_OBK.MapServer"
vektor_daten_DBO_Verbandsgrenze_AV_UTM32__3_ = "E:\\Geodaten\\gp_bildflug\\vektor_daten.sde\\vektor_daten.DBO.Verwaltungsgrenzen_NRW_UTM32\\vektor_daten.DBO.Verbandsgrenze_AV_UTM32"
Output_Map_Service_URL = ""

# Process: Manage Map Server Cache Tiles
arcpy.ManageMapServerCacheTiles_server(Bildflug_OBK_MapServer, "300", "RECREATE_EMPTY_TILES", "3", vektor_daten_DBO_Verbandsgrenze_AV_UTM32__3_, "E:\\Geodaten\\gp_bildflug\\vektor_daten.sde\\vektor_daten.DBO.Verwaltungsgrenzen_NRW_UTM32\\vektor_daten.DBO.Verbandsgrenze_AV_UTM32", "WAIT")

0 Kudos
1 Reply
New Contributor III

i think i found a solution.

  • Create and start a caching job:

C:\Python27\ArcGIS10.5>python.exe C:\Program Files\ArcGIS\Server\tools\admin\ -u ******* -p ****** -s http://localhost:6080 -n orthophotos/Bildflug_OBK:MapServer -scales "300" -mode RECREATE

_EMPTY_TILES -i 3 -extent 789189.9305308337;6580020.060890722;867403.7797850806;6641345.461643132 -wait DO_NOT_WAIT

  • Stop the caching Job:

C:\Python27\ArcGIS10.5>python.exe C:\Program Files\ArcGIS\Server\tools\admin\ -u ****** -p ****** -s http://localhost:6080 -n System/CachingTools.GPServer -o stop

  • Create a Windows Schedule Task to start the CachingTool again to cache overnight with this trigger parameter:

C:\Program Files\ArcGIS\Server\tools\admin\ -u ****** -p ****** -s http://localhost:6080 -n System/CachingTools.GPServer -o start

  • Create another Schedule Task to stop the CachingTool in the morning (....hingTools.GPServer -o stop...)

Thats it