Start Stop Services - Server Admin Toolbox

3932
4
10-01-2014 06:49 AM
BenDrury
Occasional Contributor

I am having the hardest time keeping these simple scripts up and running. It will stop them but then it will not restart them, and all I am doing is changing STOP to START in the script. it keeps telling me invalid parameters error code 000800.  Seems like which ever one I run first works, then the second one always give the "Invalid Parameters" error 000800 services is not a member invalid parameter

 

Here is the code I am using, any help would be greatly appreciated! This is driving me nuts and causing a lot of work after hours.

 

 

# -*- coding: utf-8 -*-

# ---------------------------------------------------------------------------

# StartServicesIdrisi.py

# Created on: 2014-09-30 15:01:42.00000

#   (generated by ArcGIS/ModelBuilder)

# Usage: StartServicesIdrisi <Service_List>

# Description:

# ---------------------------------------------------------------------------

 

 

# Import arcpy module

import arcpy

 

# Load required toolboxes

arcpy.ImportToolbox("//KERMIT/GIS_StaffOnly/Toolboxes/ServerAdminToolkit/Server Admin Toolkit.tbx")

 

# Script arguments

Service_List = arcpy.GetParameterAsText(0)

if Service_List == '#' or not Service_List:

    Service_List = "SampleWorldCities.MapServer;Codes//BuildingFootprintsByCodesIPad.MapServer;Codes//BuildingsWithAttachments.MapServer;Codes//CodesEnforcement.MapServer;Codes//CodesInspectionByType.MapServer;Codes//CodesInspectionOver6MonthsAgo.MapServer"

# Local variables:

Server_Name = "idrisi"

Port = "6080"

Admin_User = "*****"

Admin_Password = "******"

 

 

# Process: Stop, Start, Delete Services

arcpy.StopStartService_ESRIServerAdminToolkit(Server_Name, Port, Admin_User, Admin_Password, "Start", Service_List)

0 Kudos
4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Travis,

Looks like you are missing a quote at the end of your 'Service_List' variable.  Try the following:

import arcpy

arcpy.ImportToolbox("//KERMIT/GIS_StaffOnly/Toolboxes/ServerAdminToolkit/Server Admin Toolkit.tbx")

Service_List = "SampleWorldCities.MapServer;Codes//BuildingFootprintsByCodesIPad.MapServer;Codes//BuildingsWithAttachments.MapServer;Codes//CodesEnforcement.MapServer;Codes//CodesInspectionByType.MapServer;Codes//CodesInspectionOver6MonthsAgo.MapServer"

Server_Name = "idrisi"

Port = "6080"

Admin_User = "*****"

Admin_Password = "******"

0 Kudos
BenDrury
Occasional Contributor

Sorry I deleted a lot of that line of code for viewing purposes on here. It runs fine the first time if I stop or start them. It is when I try running it the second time to either stop them or start them back is when it fails. It returns codes 000800 and says all services are not members

0 Kudos
GregSnelling
New Contributor III

Interesting because I have a similar problem, but I'm running the agsAdmin.exe from command line.  The service stops fine, but receive error "could not find resource or operation" when the same command is run with "start" parameter.  Trying to figure out why...

0 Kudos
BenDrury
Occasional Contributor

I have started using Python-AGS-Admin_Master tools, and not problems at all. It utilizes the rest endpoints and not hard code to stop and start services. Works much better with not complications. Very easy to configure.

0 Kudos