AnsweredAssumed Answered

Stopping/Starting ArcGIS services using Python

Question asked by jnettle1 on May 16, 2012
Latest reply on May 16, 2012 by jnettle1
I am trying to find a way to start and stop a service in python so I can automate some updates. I have found the the agssom.exe script in Arcscripts. I place it in c:\windows\system32. The code I am using in my pytho script is below. The script runs with out any errors, but the service doesn't stop. Am I missing a step or does anybody have a better way of doing this?

We are running ArcGIS 10 with python 2.6.5

import os

# variables
PathToAGSSOM = r"C:\\windows\\system32\\ArcSOM.exe"
server = "VULCAN"
command = "-x" # use -x for stop
service = "Narcotics"

# use AGSSOM.exe to start map service from command line
commandLine = PathToAGSSOM + " " + server + " " + command + " " + service

print "Finished"