Looking for a way to programmaticly stop/stop the AcrGIS server Service with a batch file. Basically, we edit into a FGD, then would like to copy that FGD to another location on the network. This new location would be what is served out via Server/Portal. we have found that the FGD coping process cannot happen unless the ArcGIS services are stopped briefly. We tried using the AGSSOM.exe utility, but it is not clear that this .exe can be used in version 10.6.1. We have also tried using NET STOP and SC commands, but it is not practical as these seem to need to "run as administrator" . Might there be any suggestions? thanks, James
Is editing using a versioned geodatabase an option for you?
How about a truncate and append process so services would not need to be stopped?
I would like to have a version of database option. But for this project it is not an option
Get Outlook for Android<https://aka.ms/ghei36>
Overall, I find this approach to be problematic because while the truncate and append are happening, results returned from the service are not accurate. It is better to have a window of time where the service is unavailable than have a window of time where the results from the service are not accurate.
I like Michael Volz's suggestion of truncating and appending, but another approach is to stop the individual service or services instead of the whole ArcGIS Server service. You can take pieces out of the "stop or start all services in a folder" script to stop specific services, or create your own script:
https://developers.arcgis.com/rest/enterprise-administration/server/stopservice.htm
https://developers.arcgis.com/rest/enterprise-administration/server/startservice.htm
Jonathan:
Can the code in your first link be modified to use port 6443?
Can the code in your first link be modified to use no port if the AGS services are be routed through a load-balancer that has a certificate associated with it?
Yeah, that's possible just takes some refactoring. It looks like the httplib.HTTPSConnection would be used instead of httplib.HTTPConnection:
https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection
Then make sure you update serverPort = 6080 to be 6443 or 443, depending on what port your load balancer is listening on. The folderURL and stopOrStartURL variables, (and any others, really) would need to be corrected for the context too depending on the load balancer URL. They're using "arcgis" but you could change that if need be.
I had re-written that script within a different thread if you want to take a look for some ideas:
I agree with others, you should try stopping the individual, impacted services first before resorting to restarting the entire GIS Server. If you do end up needing to start the GIS server, i.e., the Windows service running GIS server, any Windows admin worth their pay can configure an individual service to be stopped and started by a non-admin user.