controlservices

RPLib – controlservices

RPLib.controlservices(Folder=None, Operation=None, ServerName=None, UserName=None, Password=None)[source]

Manage individual ArcGIS Server services at the folder level or through the Windows Services Console by stopping or starting the main ArcGIS Server service.

Parameter Type Description Required
Folder String

The folder containing the services you wish to stop or start on your ArcGIS Server.

  • “ALL” = Will perform the Operation on the main ArcGIS Server service through the Windows Services Console.

Note “ALL” should only be used on machines running Windows Server.

Yes
Operation String

Specify the operation you wish to perform on the service(s).

  • “START” = Will Start services.
  • “STOP” = Will Stop services.
Yes
ServerName String The name or IP address of the server where ArcGIS Server is running. Yes
UserName Boolean Specify an administrative user for ArcGIS Server. Yes
Password Boolean Specify the administrative user password for ArcGIS Server. Yes

Returns: Boolean

Usage

  • If using feature services with ArcGIS Server your data needs to reside in an SDE database.
  • During database maintenance a database administrator might need to remove locks created by these services by stopping them.
  • Map services created using data from an SDE database will also produce locks on your data by default.
  • Typically for a full compress on SDE to be achieved all connections need to be severed, this includes connections from ArcGIS Server.

Example 1

Simple call with all parameters specified.
Notice that here we are using the IP address instead of the server name.
import RPLib

folder = "LandRecords"

RPLib.controlservices(folder,"stop","192.1.1.1","administrator","password")
  • Note This will stop all services in the folder LandRecords on ArcGIS Server.

Example 2

Simple call with all parameters specified.
Notice that here we are using the server name instead of the IP address.
import RPLib

RPLib.controlservices("ALL","stop","GISAPP","administrator","password")
  • Note - This will stop the main ArcGIS Server service through the Windows Services Console.

Example 3

If Else logic with all parameters specified.
Notice that here we are using the server name instead of the IP address.
import RPLib

if RPLib.controlservices("ALL","start","GISAPP","administrator","password"):
    print("successful, run another tool")
else:
    print("failed, run another tool")
  • Note - This will start the main ArcGIS Server service through the Windows Services Console.

Example 4

If Else logic with all parameters specified.
Notice that here we are using the IP address instead of the servername.
import RPLib

folder = "LandRecords"

if RPLib.controlservices(folder,"start","192.1.1.1","administrator","password"):
    print("successful, run another tool")
else:
    print("failed, run another tool")
  • Note This will start all services in the folder LandRecords on ArcGIS Server.

Table Of Contents

Previous topic

syncreplicas

Next topic

deletefilesolderthan

This Page