Select to view content in your preferred language

Start/Stop Secure Services in 10.6.1

7480
28
03-21-2019 12:42 PM
AmyRoust
Frequent Contributor

Prior to 10.6.1, I was using the ArcGIS Server Admin Toolkit to stop and start services in bulk. That toolkit has depreciated and does not appear to work in 10.6.1. (It could be that I'm making an error with the parameters, but I don't think I am) Then I found this:

Example: Stop or start all services in a folder—ArcGIS Server Administration (Windows) | ArcGIS Ente... 

The above script assumes that you are using port 6080, but ours are on 6443. I tried to change the parameter in the same script from 6080 to 6443, but that did not work. Again, I'm not ruling out the possibility that I'm entering the wrong variables, but the error message says that the server is forcibly closing the connection to port 6443 when I run it.

In scouring the forums, I've seen comments that suggest that A) you cannot start/stop services using Python if said services are secured (https), and B) the Esri is intentionally not maintaining or developing tools to allow you to batch start/stop services anymore because they want you to do it through Server Manager/Portal/ArcCatalog. I know you can't start/stop services in Pro yet, but that it might be coming in a future version.

Can anyone help me fill in the gaps? My ultimate need is to be able to stop all web services at once and then restart them in bulk. I'm using Enterprise 10.6.1, including Portal. I published all of my services to Server using ArcMap 10.6.1.

28 Replies
MichaelVolz
Esteemed Contributor

Joris:

Were you able to get Jonathan's modified code to work for you in python 3.x?  I spent time updating my code, but it is still throwing errors when run in python 3.x so I still remain running python 2.x code.

0 Kudos
jorisfrenkel
Frequent Contributor

Hi Michael,

I adapted my own script, which had been adapted again from other scripts. I also used some sample script I found somewhere for Python 3.

I will include my script here. I will be curious to hear if it works for you!

I am also curious what your thoughts are about rewriting all user scripts for ArcGIS Server for Python 3, since I am not quite sure what the real dangers are of continuing using Python 2. I just started rewriting to Python 3 because it seemed a good idea to do, especially for a server that is accessible from the outside.

MichaelVolz
Esteemed Contributor

Thanks Joris

I have had success with other python scripts as the changes between 2.x and 3.x were the call to the mapping module, print statements, and Emailing error message and log files.

The scripts that involve stopping and starting of https AGS services has been the thorn in my side as it is working in python 2.x. but I have gotten tokens errors I believe in python 3.x that I have this far been unable to resolve.

If you are running these scripts as a Windows Scheduled Task with a concurrent use license (You might be using Named Users), you need to use Pro with that concurrent license on the machine at least once I would guess to initiate your profile otherwise the python script never runs.

0 Kudos
jorisfrenkel
Frequent Contributor

Hi Michael,

You don't need ArcGIS Pro. Python 3 is included with ArcGIS Server, at least from version 10.6.1. It is however hidden in a far away directory: C:\<Install-dir>\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\arcgispro-py3

0 Kudos
JonathanQuinn
Esri Notable Contributor

As long as you're using the same corresponding functions between Python 2.x and Python 3.x, you shouldn't see an issue. The version shouldn't impact whether a token is valid or not, unless the logic is different (if you're using different scripts), and you're not passing in the right referers or something similar.

What is the error you're seeing?

0 Kudos
BrittJohnson
Occasional Contributor

Jonathan,

In your example Python code, am I correct in assuming that as written it would stop/start all of the services on the server for the input base URL? Seeing that it appears to be looping thru services in the root, and then all sub-folders in the root directory. If that is the case, would there need to be any major modifications for it to only loop thru the services in a specific folder provided as an input parameter?

As part of migrating to Enterprise 10.8, we're moving all of our geocoding services into one sub-folder. We had an old script to stop/start individual services, but with all of the locators being in one directory now I would like to simplify things to stop or start all of the services in one call before the rebuild locator process runs.

Thanks,
Britt

0 Kudos
by Anonymous User
Not applicable

Britt,

Were you able to sort out how to stop/start all services in one sub folder? I am interested in the same thing right now.

 

Thanks,

 

Shelby

0 Kudos
BrittJohnson
Occasional Contributor

Shelby, we've had some mixed success using the new ArcGIS for Python API to stop everything in one folder. Did you ever find a good solution?

Britt

0 Kudos
GaleEllis
Occasional Contributor

I am trying to switch to the https services and this information is very useful.  The only thing I am stuck on currently is where the sslbase python module referenced above comes from.  I haven’t been able to find any other reference to it.  I see that it isn’t needed in the python 3.X version.

0 Kudos